mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-03-28 06:17:46 +01:00
adding support for e621 auth
Adding e621_user and e621_apikey to docker compose, scrapers, and runtime as credentials are required for some posts on e621.net.
This commit is contained in:
parent
2f62b999c9
commit
1290fed866
3 changed files with 11 additions and 1 deletions
|
@ -25,6 +25,8 @@ config :philomena,
|
|||
image_file_root: System.fetch_env!("IMAGE_FILE_ROOT"),
|
||||
tumblr_api_key: System.fetch_env!("TUMBLR_API_KEY"),
|
||||
inkbunny_sid: System.fetch_env!("INKBUNNY_SID"),
|
||||
e621_user: System.fetch_env!("E621_USER"),
|
||||
e621_apikey: System.fetch_env!("E621_APIKEY"),
|
||||
otp_secret_key: System.fetch_env!("OTP_SECRET_KEY"),
|
||||
image_url_root: System.fetch_env!("IMAGE_URL_ROOT"),
|
||||
badge_url_root: System.fetch_env!("BADGE_URL_ROOT"),
|
||||
|
|
|
@ -17,6 +17,8 @@ services:
|
|||
- PASSWORD_PEPPER=dn2e0EpZrvBLoxUM3gfQveBhjf0bG/6/bYhrOyq3L3hV9hdo/bimJ+irbDWsuXLP
|
||||
- TUMBLR_API_KEY=fuiKNFp9vQFvjLNvx4sUwti4Yb5yGutBN4Xh10LXZhhRKjWlV4
|
||||
- INKBUNNY_SID=4X88ktV7jxywp65Ng40ez1qTJd
|
||||
- E621_USER=hexerade
|
||||
- E621_APIKEY=merpmarp
|
||||
- OTP_SECRET_KEY=Wn7O/8DD+qxL0X4X7bvT90wOkVGcA90bIHww4twR03Ci//zq7PnMw8ypqyyT/b/C
|
||||
- ADVERT_FILE_ROOT=adverts
|
||||
- AVATAR_FILE_ROOT=avatars
|
||||
|
|
|
@ -7,7 +7,7 @@ defmodule Philomena.Scrapers.E621 do
|
|||
end
|
||||
|
||||
def scrape(_uri, url) do
|
||||
api_url = "#{url}.json"
|
||||
api_url = "#{url}.json&login=#{e621_user()}&api_key=#{e621_apikey()}"
|
||||
{:ok, %Tesla.Env{status: 200, body: body}} = Philomena.Http.get(api_url)
|
||||
|
||||
json = Jason.decode!(body)
|
||||
|
@ -39,4 +39,10 @@ defmodule Philomena.Scrapers.E621 do
|
|||
}]
|
||||
}
|
||||
end
|
||||
defp e621_user do
|
||||
Application.get_env(:philomena, :e621_user)
|
||||
end
|
||||
defp e621_apikey do
|
||||
Application.get_env(:philomena, :e621_apikey)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue