Skip to content

Commit

Permalink
Use original images with Commishes scraper (#109)
Browse files Browse the repository at this point in the history
* Use original images with Commishes scraper

* %r for regex
  • Loading branch information
faucetlol authored Dec 19, 2023
1 parent de7a704 commit 842f528
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/logical/scraper/commishes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,14 @@ def get_ids_from_page(page)
def get_details(urls)
urls.map do |url|
html = fetch_html(url, headers: headers)
script_containing_id = html.xpath("//script[contains(text(), '/upload/tag/')]").first
original_image_id = script_containing_id.text.match(%r{/(\d+)/remove/})[1]
{
identifier: url.split("/").pop,
title: html.at("h1#upload-title").content,
description: "",
created_at: html.at("h1#upload-title").parent.content.sub(/.*\u00a9.*(\d{4}) -/, '\1'),
file_url: html.at("img#preview")["data-large"],
file_url: "https://portfolio.commishes.com/image/#{original_image_id}/original/",
}
end
end
Expand Down

0 comments on commit 842f528

Please sign in to comment.