brwiki 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/brwiki.rb +52 -0
- metadata +44 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: aae5e8e04b9b5e3c528e7e85dda1b80ff4e32b6ccc5a45142724b4566904a2d2
|
4
|
+
data.tar.gz: 7b63193792ab64764082067989f4feb92c38a5bce0e879dd2cd394f1168fdf1f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6cf57f81a7b0961a6ac63192a7190978862c8f5b7aa7b5714469acb964e245664eca49156e709aa1b75a02b3de797dd8bc8fc4de64c032d5b902a7a73bf22abf
|
7
|
+
data.tar.gz: 1d1973ccbb56be929a297fe40a3a39e1c7f1d918f65b4dade0801bf9d9e805948f724f009779af712488647408f58a6d10de0fb71a17a928f79bc1be170f56da
|
data/lib/brwiki.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
require 'nokogiri'
|
3
|
+
|
4
|
+
class Brwiki
|
5
|
+
|
6
|
+
extend HTTParty
|
7
|
+
extend Nokogiri
|
8
|
+
|
9
|
+
attr_reader :fonte
|
10
|
+
attr_reader :sitehtml
|
11
|
+
|
12
|
+
def initialize(artigo)
|
13
|
+
@fonte = "https://pt.m.wikipedia.org/wiki/#{artigo}"
|
14
|
+
@site = HTTParty.get("https://pt.m.wikipedia.org/wiki/#{artigo}")
|
15
|
+
@sitehtml = Nokogiri::HTML(@site.response.body)
|
16
|
+
end
|
17
|
+
|
18
|
+
def gettitle
|
19
|
+
sitehtml = Nokogiri::HTML(@site.response.body)
|
20
|
+
|
21
|
+
seleciona_tag = @sitehtml.css("title")
|
22
|
+
|
23
|
+
seleciona_tag = seleciona_tag.to_s
|
24
|
+
|
25
|
+
titulo_sem_tags = seleciona_tag.gsub(
|
26
|
+
"<title>",
|
27
|
+
""
|
28
|
+
)
|
29
|
+
|
30
|
+
titulo_sem_tags = titulo_sem_tags.gsub(
|
31
|
+
"</title>",
|
32
|
+
""
|
33
|
+
)
|
34
|
+
|
35
|
+
return titulo_sem_tags
|
36
|
+
end
|
37
|
+
|
38
|
+
possiveis_tags = ["<p>","</p>","<h1>","</h1>","<i>","</i>","<b>","</b>","<span>","</span>"]
|
39
|
+
|
40
|
+
def getdescription
|
41
|
+
p = @sitehtml.search("p")[2]
|
42
|
+
|
43
|
+
puts "#{p.text}"
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
def getlink
|
48
|
+
fonte = @fonte
|
49
|
+
return fonte
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
metadata
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: brwiki
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Luiz
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-10-19 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: obtenha paginas do wikipedia direto em seu terminal
|
14
|
+
email: luizfelip079@outlook.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/brwiki.rb
|
20
|
+
homepage: https://rubygems.org/gems/brwiki
|
21
|
+
licenses:
|
22
|
+
- MIT
|
23
|
+
metadata:
|
24
|
+
source_code_uri: https://github.com/example/example
|
25
|
+
post_install_message:
|
26
|
+
rdoc_options: []
|
27
|
+
require_paths:
|
28
|
+
- lib
|
29
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - ">="
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
requirements: []
|
40
|
+
rubygems_version: 3.2.22
|
41
|
+
signing_key:
|
42
|
+
specification_version: 4
|
43
|
+
summary: wikipedia
|
44
|
+
test_files: []
|