Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update crypto newsletter substack to RSS. fixes #4496 #4497

Merged
merged 5 commits into from
Mar 21, 2023

Conversation

jfarid27
Copy link
Contributor

@jfarid27 jfarid27 commented Mar 15, 2023

Description

Substack must have updated their HTML and UI, so this PR migrates to RSS feeds to fetch newsletter updates.
This PR:

  • Fixes the error by converting to RSS
  • Removes Bankless, as they have redone their UI away from substack and currently do not use RSS feeds.

Issue

#Fixes 4496

Screenshots

Before

Screenshot from 2023-03-15 12-35-15

After

Screenshot from 2023-03-15 15-32-32

  • Summary of the change / bug fix.
  • Link # issue, if applicable.
  • Screenshot of the feature or the bug before/after fix, if applicable.
  • Relevant motivation and context.
  • List any dependencies that are required for this change.

How has this been tested?

  • Please describe the tests that you ran to verify your changes.
  • Provide instructions so we can reproduce.
  • Please also list any relevant details for your test configuration.
  • Make sure affected commands still run in terminal
  • Ensure the SDK still works
  • Check any related reports

Checklist:

Others

  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.

@reviewpad reviewpad bot added the feat XL Extra Large feature label Mar 15, 2023
@jfarid27 jfarid27 marked this pull request as draft March 15, 2023 18:31
Copy link
Contributor Author

@jfarid27 jfarid27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the only weird issue is the large LOC in the test. Because the feed XML fetch is wide, the LOC change is large. Do we typically see this many lines added in test cassettes?

@@ -18,8 +18,8 @@


@log_start_end(log=logger)
def scrape_substack(url: str) -> List[List[str]]:
"""Helper method to scrape newsletters from substack.
def scrape_substack_rss(url: str, limit: int = 10) -> List[List[str]]:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to Substack RSS naming for less confusion.

)
rss = soup.find("rss")
if rss:
posts = rss.find_all("item")[:limit]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RSS XML feeds use "item"

time: str = post.find("time").get("datetime")
title: str = post.title.text
post_url: str = post.link.text
time_str = post.pubDate.text.split(" (")[0]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RSS items use "pubDate" as the date. This also splits since substack returns extra text in the pubdate that has to be parsed out.

"https://thedefiant.io/api/feed",
"https://thedailygwei.substack.com/feed",
"https://todayindefi.substack.com/feed",
"https://defislate.substack.com/feed",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the same substacks, just the RSS feed. Also removed Bankless.

@jfarid27 jfarid27 marked this pull request as ready for review March 15, 2023 19:45
@codecov
Copy link

codecov bot commented Mar 17, 2023

Codecov Report

❗ No coverage uploaded for pull request base (develop@d671884). Click here to learn what that means.
Patch has no changes to coverable lines.

Additional details and impacted files
@@            Coverage Diff             @@
##             develop    #4497   +/-   ##
==========================================
  Coverage           ?   55.37%           
==========================================
  Files              ?      585           
  Lines              ?    53216           
  Branches           ?        0           
==========================================
  Hits               ?    29470           
  Misses             ?    23746           
  Partials           ?        0           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@jmaslek jmaslek enabled auto-merge March 21, 2023 13:40
@jmaslek jmaslek added this pull request to the merge queue Mar 21, 2023
@jmaslek jmaslek merged commit a43e414 into OpenBB-finance:develop Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat XL Extra Large feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants