Skip to content

Instantly share code, notes, and snippets.

@kaosf
Created November 8, 2017 07:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaosf/af524a68c4f39a0f5f94582da8723b4b to your computer and use it in GitHub Desktop.
Save kaosf/af524a68c4f39a0f5f94582da8723b4b to your computer and use it in GitHub Desktop.
Idol time PriPara ani.tv URL parser
url_common = 'https://ch.ani.tv'
url = url_common + '/titles/353' # 353 is ipp ID
require 'open-uri'
html = open(url).read
require 'nokogiri'
doc = Nokogiri::HTML.parse html
# latest only
#puts url_common + doc.xpath('//*[@id="title-detail"]/div[1]/div[3]/div/a').attribute('href')
# 1, 2, 3, ... latest
doc.xpath('//*[@id="title-detail"]/div[1]/div[4]/div/a').each do |e|
puts url_common + e.attribute('href')
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment