8000 Twitter Embeds · Issue #56 · leoncvlt/loconotion · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Twitter Embeds #56

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

Open
jaymu53 opened this issue Apr 28, 2021 · 1 comment
Open

Twitter Embeds #56

jaymu53 opened this issue Apr 28, 2021 · 1 comment

Comments

@jaymu53
Copy link
jaymu53 commented Apr 28, 2021

So I had some tweet embeds in some of my Notion pages that aren't being rendered properly.

You can use the Twitter embed API to get the HTML for the tweet and replace the tag that's currently on the page.

Currently, I'm using Location to download all the pages and then doing some clean-up.

This is how I'm adding in the tweet embeds:

`tweets = soup.findAll("twitter-widget")

for tweet in tweets:
    tweet_url = "https://twitter.com/name/status/" + tweet.attrs['data-tweet-id']
    twitter_api = "https://publish.twitter.com/oembed?url=" + tweet_url
    tweet_embed_html = requests.get(twitter_api).json()['html'].replace("\n", "")
    tweet_embed_html = "<div style='width: 300'>" + tweet_embed_html + "</div>"
    tweet.append(BeautifulSoup(tweet_embed_html, 'html.parser'))`

Can I add this to the repo?

@leoncvlt
Copy link
Owner
leoncvlt commented May 8, 2021

Could you link an example of a page with broken tweets when parsing? Maybe we can figure out a way to get them to behave. If not, more than happy to adopt your implementation :)

mycodingdad added a commit to mycodingdad/loconotion that referenced this issue Jul 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0