qiita_trend 0.5.1 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ad6633f75fafb54ce0bbc8438e3f94ae716ff1001baecac98ba5f141a6d59efd
4
- data.tar.gz: a71a9b6fd1901f0031c248d8c8a2624de99dbce2b979d44a2c28ecc8708f3aad
3
+ metadata.gz: f26c4218cd093108c11aecd1dcb8a04166be5cad85ff6724975b5ca4cac1fdc2
4
+ data.tar.gz: c65a8527ca461ed7f29a0e0f2d5a943f917d61102dc670efcdce94600316ad0c
5
5
  SHA512:
6
- metadata.gz: 06426b8b6d6118d52c612aa110c21cf6ce3553d2d1f95c1eb7c24440834c0be93aedd5144ec7d770ce03e2fcee3d83cfc19a6105ddc74902e981bbd9170ffb50
7
- data.tar.gz: 171a7c15b21baed1f98ee3ab328d310908ce94033d7c64cc8a1bbe8c6ee7f5b37688077364852e5c90347885d6a1659a37a5a2ccc332c1e796716f5c9faa4640
6
+ metadata.gz: 3fc0a83b3f0a0b4e9b8d3d3796d1d6d1c46a44952dcd78433364a00816b918e728b742d5a2dd269f2c781b2f94107c6c4425e824da2b51cca6d68666f06621a6
7
+ data.tar.gz: 3a7d4e7fe50f2d9247b5c41726c27a73f65b76c85d138b2284cc11d93e193bd8469a07e102d4c89b8801457f7689600b72925bda5da9ee8d6ea9e66745039a6d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- qiita_trend (0.5.1)
4
+ qiita_trend (0.5.2)
5
5
  mechanize (~> 2.7)
6
6
  nokogiri (~> 1.11)
7
7
 
@@ -22,7 +22,7 @@ module QiitaTrend
22
22
  @trend_type = trend_type
23
23
  page = Page.new(trend_type, date)
24
24
  parsed_html = Nokogiri::HTML.parse(page.html)
25
- xpath_str = '//script[@data-component-name="HomeIndexPage"]'
25
+ xpath_str = get_xpath(trend_type)
26
26
  trends_data = JSON.parse(parsed_html.xpath(xpath_str)[0].text)
27
27
  @data = get_data(trends_data, trend_type)
28
28
  end
@@ -59,6 +59,14 @@ module QiitaTrend
59
59
 
60
60
  private
61
61
 
62
+ # Qiitaのトレンド情報を格納しているxpathを取得する
63
+ #
64
+ # @param [TrendType] trend_type トレンドタイプ
65
+ # @return [String] トレンドタイプによるxpath
66
+ def get_xpath(trend_type)
67
+ trend_type == TrendType::PERSONAL ? '//script[@data-component-name="New2HomeIndexPage"]' : '//script[@data-component-name="HomeIndexPage"]'
68
+ end
69
+
62
70
  # Qiitaのトレンドのデータを取得する
63
71
  #
64
72
  # @param [Hash] trends_data トレンドデータ
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module QiitaTrend
4
- VERSION = '0.5.1'
4
+ VERSION = '0.5.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qiita_trend
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - dodonki1223
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-12-28 00:00:00.000000000 Z
11
+ date: 2022-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mechanize