panchira 1.3.2 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4b6ab5f09a68a55d7fa54720b6ed5544605c5b4fa25ff839583058ac3af5611b
4
- data.tar.gz: 22814f2437ac515c59d22a634c4709212eb639735a831157b7a64375559c1cf1
3
+ metadata.gz: 6efe3f2eddf6984db580aebed3d142e7ba8cab9df8b5f69742b9692d62b83dc5
4
+ data.tar.gz: d86faa63aeb5cf4b963a420575f8522dbd4f079f91af23b03e0ff8e79dc026fc
5
5
  SHA512:
6
- metadata.gz: a2a42f6023db6ce19d076079044c6fd88e49870478590d89ad25810dd3b72e72439627b416bd3d439d78ab8eaa72683746617fe565f441e69a758811e4b50023
7
- data.tar.gz: 6f4573bf646ea21d9d5887ee67a1e95e275e6b1de6d152d4c096c7b8a4e70fa29409143a8a00af0c32f6a1e023f4b0a5c84a30d50fd789dc5f6822cb161cd0ed
6
+ metadata.gz: 0ab350c44ea6e8374926f4cea197320bdfb65b5f243c70f3943a775e32b8bc75c26910380326face1fc1a157d03b78f8d81fe5f5eda26b7516d55d13edda3ec9
7
+ data.tar.gz: 272f6e3deea2b6e0e1f678c32e1e3e00dddb10d2fa74626ff6e5fe5787864ec76f054d1679448e0b174ba34aba600d1c923606336690f2a7f7b7d60353054668
@@ -16,7 +16,7 @@ on:
16
16
  jobs:
17
17
  test:
18
18
 
19
- runs-on: ubuntu-latest
19
+ runs-on: ubuntu-18.04
20
20
 
21
21
  steps:
22
22
  - uses: actions/checkout@v2
data/CHANGELOG.md CHANGED
@@ -4,10 +4,17 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](http://keepachangelog.com/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/).
6
6
 
7
+ ## 1.3.3 - 2021-07-25
8
+ ### Added
9
+ - Added Support for Iwara.
10
+
11
+ ### Fixed
12
+ - Fixed an issue where DLsite Resolver was retrieving wrong tags.
13
+
7
14
  ## 1.3.2 - 2021-05-23
8
15
  ### Fixed
9
- - Fixed an issue where Fanza Resolver was retrieving incorrect cannonical URLs from meta tags.
10
- - Fixed an issue where Narou Resolver retrieved wrong descriptions from meta tags.
16
+ - Fixed an issue where Fanza Resolver was retrieving incorrect canonical URLs.
17
+ - Fixed an issue where Narou Resolver was retrieving wrong descriptions.
11
18
 
12
19
  ### Changed
13
20
  - Updated dependencies.
@@ -79,6 +86,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
79
86
  ### Added
80
87
  - Released Panchira gem. At this time we can parse only 5 websites.
81
88
 
89
+ [1.3.2]: https://github.com/nuita/panchira/releases/tag/v1.3.2
82
90
  [1.3.1]: https://github.com/nuita/panchira/releases/tag/v1.3.1
83
91
  [1.3.0]: https://github.com/nuita/panchira/releases/tag/v1.3.0
84
92
  [1.2.0]: https://github.com/nuita/panchira/releases/tag/v1.2.0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- panchira (1.3.2)
4
+ panchira (1.3.3)
5
5
  fastimage (~> 2.1.7)
6
6
  nokogiri (>= 1.10.9, < 1.12.0)
7
7
 
data/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  Due to some legal or ethical issues, most hentai and NSFW platforms don't clarify their content on meta tags. As a result, most hentai platforms are rendered poorly on the card previews on social media.
8
8
 
9
- To solve this issue, Panchira is made to parse correct and uncensored metadata from such web platforms (at this time we cover **DLSite, Komiflo, Melonbooks, Nijie, Pixiv, Shousetsuka ni narou, Fanza and Twitter**).
9
+ To solve this issue, Panchira is made to parse correct and uncensored metadata from such web platforms (at this time we cover **DLSite, Komiflo, Melonbooks, Nijie, Pixiv, Shousetsuka ni narou, Fanza, Iwara and Twitter**).
10
10
 
11
11
  If you need card previews of hentai on your web application, but can't get them with simply parsing metatags, then it is time for Panchira.
12
12
 
@@ -39,7 +39,13 @@ module Panchira
39
39
  end
40
40
 
41
41
  def parse_tags
42
- @page.css('.main_genre').children.children.map(&:text)
42
+ @page.css('table[id*="work_"] tr').each do |tr|
43
+ next unless tr.css('th').text =~ /ジャンル/
44
+
45
+ return tr.css('td a').map do |node|
46
+ node.text.strip
47
+ end
48
+ end
43
49
  end
44
50
  end
45
51
 
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Panchira
4
+ class IwaraResolver < Resolver
5
+ URL_REGEXP = /(www|ecchi)\.iwara\.tv\//.freeze
6
+
7
+ private
8
+ def parse_title
9
+ super.split(' | ')[0]
10
+ end
11
+
12
+ def parse_image_url
13
+ url = @page.at_css('#video-player')&.attributes['poster']&.value
14
+ 'https:' + url if url
15
+ end
16
+
17
+ def parse_author
18
+ @page.at_css('.node-info .username')&.children&.[](0)&.text
19
+ end
20
+
21
+ def parse_tags
22
+ @page.css('.node-info .field-item').map { |e| e.children&.text }
23
+ end
24
+
25
+ def cookie
26
+ 'show_adult=1'
27
+ end
28
+
29
+ def parse_canonical_url
30
+ @url # canonical has relative path. ignore it
31
+ end
32
+ end
33
+
34
+ ::Panchira::Extensions.register(Panchira::IwaraResolver)
35
+ end
@@ -37,6 +37,11 @@ module Panchira
37
37
  # つらい。
38
38
  @desc&.xpath('//*[@id="noveltable1"]/tr[3]')&.text&.split("\n\n\n")&.dig(1)&.split(' ')
39
39
  end
40
+
41
+ # og:urlで指定されたncode.syosetu.com/~~~にアクセスすると301で戻されるので何もしない
42
+ def parse_canonical_url
43
+ @url
44
+ end
40
45
  end
41
46
 
42
47
  class NcodeResolver < Resolver
@@ -63,6 +68,11 @@ module Panchira
63
68
  # めっちゃつらい。
64
69
  @desc&.xpath('//*[@id="noveltable1"]/tr[3]')&.text&.split("\n\n\n")&.dig(1)&.delete("\u00A0")&.split(' ')&.grep_v('')
65
70
  end
71
+
72
+ # og:urlで指定されたncode.syosetu.com/~~~にアクセスすると301で戻されるので何もしない
73
+ def parse_canonical_url
74
+ @url
75
+ end
66
76
  end
67
77
  end
68
78
 
@@ -67,17 +67,20 @@ module Panchira
67
67
  # fetch page and refresh canonical_url until canonical_url converges.
68
68
  loop do
69
69
  url_in_res = @page.css('//link[rel="canonical"]/@href').to_s
70
+ if url_in_res.empty?
71
+ url_in_res = @page.css('//meta[property="og:url"]/@content').to_s
72
+ end
70
73
 
71
74
  if url_in_res.empty?
72
75
  return history.last || @url
73
- else
74
- if history.include?(url_in_res) || history.length > 5
75
- return url_in_res
76
- else
77
- history.push(url_in_res)
78
- @page = fetch_page(url_in_res)
79
- end
80
76
  end
77
+
78
+ if history.include?(url_in_res) || history.length > 5
79
+ return url_in_res
80
+ end
81
+
82
+ history.push(url_in_res)
83
+ @page = fetch_page(url_in_res)
81
84
  end
82
85
  end
83
86
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Panchira
4
- VERSION = '1.3.2'
4
+ VERSION = '1.3.3'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: panchira
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - kyp
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-05-23 00:00:00.000000000 Z
11
+ date: 2021-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -141,6 +141,7 @@ files:
141
141
  - lib/panchira/resolvers/dlsite_resolver.rb
142
142
  - lib/panchira/resolvers/fanza_resolver.rb
143
143
  - lib/panchira/resolvers/image_resolver.rb
144
+ - lib/panchira/resolvers/iwara_resolver.rb
144
145
  - lib/panchira/resolvers/komiflo_resolver.rb
145
146
  - lib/panchira/resolvers/melonbooks_resolver.rb
146
147
  - lib/panchira/resolvers/narou_resolver.rb