alexthemitchell / blott

A Rust-based blogging platform requiring no server daemon
2 stars 0 forks source link

Integrate Twitter hashtag viewer into post page #5

Open alexthemitchell opened 7 years ago

alexthemitchell commented 7 years ago

From Twitter:

 <a class="twitter-timeline" data-dnt="true" href="https://twitter.com/hashtag/Hashtag" data-widget-id="907050230809468928">#Hashtag Tweets</a>
            <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
alexthemitchell commented 7 years ago

Twitter doesn't allow dynamic changing of the query. The actual results are determined by the data-widget-id in the link; which must be manually generated for each timeline widget. Perhaps I can script timeline search creation and inject a new widget into each generated page. I could also just use an old fashioned iframe, but that would be way more clunky. Probably the best solution is to just parse using the native API.