added hash as guid for rss
This commit is contained in:
10
rss_gen.py
10
rss_gen.py
@@ -33,7 +33,7 @@ XML_END = """</channel></rss>"""
|
||||
load_dotenv()
|
||||
copyparty_token = os.getenv('COPYPARTY_TOKEN')
|
||||
|
||||
def make_torrent_entry(name, timestamp, category):
|
||||
def make_torrent_entry(name, timestamp, hash, category):
|
||||
if category:
|
||||
category = "DODI_Repack"
|
||||
else:
|
||||
@@ -56,22 +56,22 @@ def write_file(path, data):
|
||||
|
||||
def create_25_recent_feed(df):
|
||||
most_recent_25 = df.sort_values("timestamp", ascending=False).head(25)
|
||||
latest_25_xml = "\n".join([make_torrent_entry(i[0], i[2], i[3]) for i in most_recent_25.values])
|
||||
latest_25_xml = "\n".join([make_torrent_entry(i[0], i[2], i[3], i[4]) for i in most_recent_25.values])
|
||||
write_file("RSS/recent_25.xml", XML_BEGIN_RECENT+latest_25_xml+XML_END)
|
||||
|
||||
def create_48h_latest(df):
|
||||
last_48_hours = df[df['timestamp'] > datetime.now() - pd.Timedelta(days=2)]
|
||||
last_48_hours = last_48_hours.sort_values("timestamp", ascending=False)
|
||||
last_48_xml = "\n".join([make_torrent_entry(i[0], i[2], i[3]) for i in last_48_hours.values])
|
||||
last_48_xml = "\n".join([make_torrent_entry(i[0], i[2], i[3], i[4]) for i in last_48_hours.values])
|
||||
write_file("RSS/latest_48h.xml", XML_BEGIN_LAST+last_48_xml+XML_END)
|
||||
|
||||
def create_df():
|
||||
torfiles_scrape = requests.get("https://upload.fieryeagle.org/torfiles", auth=("torbot",copyparty_token))
|
||||
soup = BeautifulSoup(torfiles_scrape.content, "html.parser")
|
||||
rows = [i.find_all("td") for i in soup.tbody.find_all("tr")]
|
||||
filtered_rows = [[i[1].text, i[6].text, datetime.strptime(i[9].text, "%Y-%m-%d %H:%M:%S")] for i in rows]
|
||||
filtered_rows = [[i[1].text, i[6].text, i[4].text, datetime.strptime(i[9].text, "%Y-%m-%d %H:%M:%S")] for i in rows]
|
||||
df = pd.DataFrame(
|
||||
data=filtered_rows, columns=["name", "upload_ip", "timestamp"]
|
||||
data=filtered_rows, columns=["name", "upload_ip", "hash", "timestamp"]
|
||||
)
|
||||
|
||||
df['is_repack'] = df['name'].str.contains('DODI', case=False)
|
||||
|
||||
Reference in New Issue
Block a user