panchira 1.5.0 → 1.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -1
- data/Gemfile.lock +11 -10
- data/README.md +8 -0
- data/lib/panchira/resolvers/dlsite_resolver.rb +4 -0
- data/lib/panchira/resolvers/pixiv_resolver.rb +17 -2
- data/lib/panchira/resolvers/twitter_resolver.rb +3 -0
- data/lib/panchira/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0a6e502368c14a15073925a7c717646a8e59ff1fbb17240aba4abdedd93fec7
|
4
|
+
data.tar.gz: 42557986e00b95619e845c79b20a15f17370fbf72b8bf163f98e0a1660d2d244
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f500d879e81fda3ac9c3869b16293b1591da1ac60b149e679fa35be797524a63e01696995f9e4d46f3e0854f213dc276dc84427cbb4bd0086504b931e9ac3f0
|
7
|
+
data.tar.gz: 120c8d8c4d86b3a6dda82d14b9cc63a9e9854d930b835fb46681c2392cabce0807ee67332fe2aaafea4f7afd4f626001842a53a8aa8cdb853bb2c7ff6c1773c2
|
data/CHANGELOG.md
CHANGED
@@ -4,10 +4,25 @@ 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.5.3 - 2022-06-04
|
8
|
+
### Fixed
|
9
|
+
- Fixed an issue where Pixiv resolver can't retrieve image urls for manga.
|
10
|
+
|
11
|
+
### Changed
|
12
|
+
- DLsite resolver now returns descriptions without platform PR sentences.
|
13
|
+
|
14
|
+
## 1.5.2 - 2022-03-20
|
15
|
+
### Fixed
|
16
|
+
- Fixed an issue where Pixiv resolver can't retrieve not-proxied image scales.
|
17
|
+
|
18
|
+
## 1.5.1 - 2022-03-20
|
19
|
+
### Added
|
20
|
+
- Pixiv resolver can now fetch image URIs that are not proxied.
|
21
|
+
|
7
22
|
## 1.5.0 - 2022-03-01
|
8
23
|
### Changed
|
9
24
|
- You can now set options in Panchira::fetch and Resolver's constructors.
|
10
|
-
- Twitter
|
25
|
+
- Twitter resolver can now fetch datas from API (requires bearer token).
|
11
26
|
- Max execution time is now set to 10 seconds.
|
12
27
|
|
13
28
|
## 1.4.0 - 2022-01-10
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
panchira (1.5.
|
4
|
+
panchira (1.5.3)
|
5
5
|
fastimage (~> 2.1.7)
|
6
6
|
nokogiri (>= 1.10.9, < 1.14.0)
|
7
7
|
|
@@ -12,35 +12,36 @@ GEM
|
|
12
12
|
fastimage (2.1.7)
|
13
13
|
mini_portile2 (2.8.0)
|
14
14
|
minitest (5.15.0)
|
15
|
-
nokogiri (1.13.
|
15
|
+
nokogiri (1.13.6)
|
16
16
|
mini_portile2 (~> 2.8.0)
|
17
17
|
racc (~> 1.4)
|
18
|
-
parallel (1.
|
19
|
-
parser (3.1.
|
18
|
+
parallel (1.22.1)
|
19
|
+
parser (3.1.2.0)
|
20
20
|
ast (~> 2.4.1)
|
21
21
|
racc (1.6.0)
|
22
22
|
rainbow (3.1.1)
|
23
23
|
rake (12.3.3)
|
24
|
-
regexp_parser (2.
|
24
|
+
regexp_parser (2.5.0)
|
25
25
|
rexml (3.2.5)
|
26
|
-
rubocop (1.
|
26
|
+
rubocop (1.30.0)
|
27
27
|
parallel (~> 1.10)
|
28
28
|
parser (>= 3.1.0.0)
|
29
29
|
rainbow (>= 2.2.2, < 4.0)
|
30
30
|
regexp_parser (>= 1.8, < 3.0)
|
31
|
-
rexml
|
32
|
-
rubocop-ast (>= 1.
|
31
|
+
rexml (>= 3.2.5, < 4.0)
|
32
|
+
rubocop-ast (>= 1.18.0, < 2.0)
|
33
33
|
ruby-progressbar (~> 1.7)
|
34
34
|
unicode-display_width (>= 1.4.0, < 3.0)
|
35
|
-
rubocop-ast (1.
|
35
|
+
rubocop-ast (1.18.0)
|
36
36
|
parser (>= 3.1.1.0)
|
37
|
-
rubocop-minitest (0.
|
37
|
+
rubocop-minitest (0.20.0)
|
38
38
|
rubocop (>= 0.90, < 2.0)
|
39
39
|
ruby-progressbar (1.11.0)
|
40
40
|
unicode-display_width (2.1.0)
|
41
41
|
|
42
42
|
PLATFORMS
|
43
43
|
ruby
|
44
|
+
x86_64-linux
|
44
45
|
|
45
46
|
DEPENDENCIES
|
46
47
|
bundler (~> 2.0)
|
data/README.md
CHANGED
@@ -56,6 +56,14 @@ To use Twitter API instead of normal scraping, please set Twitter's bearer token
|
|
56
56
|
> Panchira.fetch("https://twitter.com/example/status/1234567890", options: {twitter: {bearer_token: 'ABC...123'}})
|
57
57
|
```
|
58
58
|
|
59
|
+
### About Pixiv proxy
|
60
|
+
|
61
|
+
By default, Panchira returns a link to [Pixiv.cat](https://pixiv.cat/) as a image URI, but you can change this behavior by setting `fetch_raw_image_url` as an option. To access not-proxied URI, pximg.net, you have to set Referer as `https://app-api.pixiv.net/` in HTTP request header.
|
62
|
+
|
63
|
+
```
|
64
|
+
> Panchira.fetch("https://pixiv.net/artworks/12345678", options: {pixiv: {fetch_raw_image_url: true}})
|
65
|
+
```
|
66
|
+
|
59
67
|
## Development
|
60
68
|
|
61
69
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -10,6 +10,8 @@ module Panchira
|
|
10
10
|
|
11
11
|
raw_json = URI.parse("https://www.pixiv.net/ajax/illust/#{@illust_id}").read('User-Agent' => user_agent)
|
12
12
|
@json = JSON.parse(raw_json)
|
13
|
+
|
14
|
+
@fetch_raw_image_url = options&.dig(:pixiv, :fetch_raw_image_url)
|
13
15
|
end
|
14
16
|
|
15
17
|
private
|
@@ -26,11 +28,24 @@ module Panchira
|
|
26
28
|
"https://pixiv.net/member_illust.php?mode=medium&illust_id=#{@illust_id}"
|
27
29
|
end
|
28
30
|
|
31
|
+
def parse_image
|
32
|
+
image = PanchiraImage.new
|
33
|
+
image.url = parse_image_url
|
34
|
+
image.width, image.height = FastImage.size(image.url, http_header: {'Referer' => 'https://app-api.pixiv.net/'})
|
35
|
+
|
36
|
+
image
|
37
|
+
end
|
38
|
+
|
29
39
|
def parse_image_url
|
40
|
+
if @fetch_raw_image_url
|
41
|
+
return @json['body']['urls']['original']
|
42
|
+
end
|
43
|
+
|
30
44
|
proxy_url = "https://pixiv.cat/#{@illust_id}.jpg"
|
31
45
|
|
32
|
-
case Net::HTTP.get_response(URI.parse(proxy_url))
|
33
|
-
when Net::
|
46
|
+
case res = Net::HTTP.get_response(URI.parse(proxy_url))
|
47
|
+
when Net::HTTPMovedPermanently
|
48
|
+
# 301が返された場合、locationで渡されたURIにホストが含まれず扱いづらいため決め打ちする
|
34
49
|
proxy_url = "https://pixiv.cat/#{@illust_id}-1.jpg"
|
35
50
|
end
|
36
51
|
|
data/lib/panchira/version.rb
CHANGED
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.5.
|
4
|
+
version: 1.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kyp
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-03
|
11
|
+
date: 2022-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|