Closed Linkerss closed 6 months ago
Hi! Sorry for the late reply.
I think you can achieve what you are looking for by removing this piece of code in views/twitter_feed.erb
:
https://github.com/stefansundin/rssbox/blob/5c544f2bf9d95461360df18ebeed778a47b333a6/views/twitter_feed.erb#L38-L42
But that will remove pictures that are not related to videos as well. So to fix that, you can change the section above to be:
if t.has_key?("extended_entities")
t["extended_entities"]["media"].each do |entity|
if entity["video_info"]
video = entity["video_info"]["variants"].sort do |a,b|
if a["content_type"].start_with?("video/") && b["content_type"].start_with?("video/")
b["bitrate"] - a["bitrate"]
else
b["content_type"].start_with?("video/") <=> a["content_type"].start_with?("video/")
end
end[0]
if /\/\d+x\d+\// =~ video["url"]
# there is dimension information in the URL (i.e. /ext_tw_video/)
text += " #{video["url"]}"
else
# no dimension information in the URL, so add some (i.e. /tweet_video/)
text += " #{video["url"]}#w=#{entity["sizes"]["large"]["w"]}&h=#{entity["sizes"]["large"]["h"]}"
end
else
text += " #{entity["media_url_https"]}"
end
end
end
I hope that works.
Hey Stefan, It's working perfectly.
I admire your work so much. I think you're an genius.
However I would like to know when you will add option for Instagram hashtags feature?
It's kind of urgent. The other Instagram bridges are crashing constantly and doesn't deliver feeds on time.
Thank you so much
Oh, sorry, I see that you filed a different issue about hashtags.
I am not planning on implementing that at this moment.. to do it yourself, you'd need to do something like the following in app.rb
:
get %r{/twitter/search/(?<q>.+)} do |q|
@q = "##{q}"
response = Twitter.get("/search/tweets.json", query: {
q: @q,
count: 100,
})
# return response.body
@data = response.json
erb :twitter_feed
end
But the JSON that this returns isn't compatible with the current view. So you can uncomment the line that says # return response.body
to look at the data, then you have to update views/twitter_feed.erb
to be able to output a nice feed from that data. You should probably copy that file to a new file, e.g. views/twitter_search_feed.erb
.
Keep in mind that there is a lower rate limit for search API calls. Here is the full documentation from Twitter: https://developer.twitter.com/en/docs/tweets/search/api-reference/get-search-tweets
Good luck!
Are you talking about Twitter hashtags or Instagram hashtags?
I meant on Instagram hashtags :)
Thank you anyway,
Happy Holidays :)
Oh, oops.. yes, I missed "Instagram" :)
Instagram would be harder.. you'd need to find the correct GraphQL query that they use for it.. since the Instagram API is closed these days, it needs a lot more work and the resulting code is very fragile. They have broken it many times since I worked around it when they first closed the API.
Happy holidays!
Hey Stefan, I presume this might be Importer issue but is there any chance to exclude featured image from Twitter videos?
I can remove them with CSS but then in some cases when video is not fetched the image is missing due to CSS,
Thank you