[ / / / / / / / / / / / / / ] [ dir / random / 93 / biohzrd / hkacade / hkpnd / tct / utd / uy / yebalnia ]

/comms/ - COMMS

anons talking with anons to anons about anons anonymously
Name
Email
Subject
REC
STOP
Comment *
File
Password (Randomized for file and post deletion; you may also set your own.)
Archive
* = required field[▶Show post options & limits]
Confused? See the FAQ.
Embed
(replaces files and can be used instead)
Options

Allowed file types:jpg, jpeg, gif, png, webp,webm, mp4, mov, pdf
Max filesize is16 MB.
Max image dimensions are15000 x15000.
You may upload5 per post.


Index | Catalog | /qresearch/ | /projectdcomms/
We Are The News | QResearch Board Search | QMAP Qanon Drops

File: e6dd9d059060790⋯.png (67.63 KB,783x752,783:752,Code.png)

7f5574 No.15787

>>9511197

def enter_urls

urls.each do |url|

3.times do

enter_url_and_click_preview("#{url}?#{rand(10_000)}=#{rand(10_000)}")

end

enter_url_and_click_preview(url)

end

end>>9511197

Dynamically generates social images.

There is more to the process than simply generating the image. We also need a cache-busting bot in order to update the card periodically. If we want to show a growing number of comments over time, we cannot wait for Twitter to bust the cache once per week. It still won't update instantly, but if a tweet has been floating around for a while it will show an accurate comment count even if it is more than when the tweet went out originally.

Twitter does not expose their cache-busting feature via API, so we had to ping it via browser automation.

It's a Ruby file which makes use of Capybara and Selenium to automate the process of pinging the Twitter card cache validation. It makes use of basically these three methods:

def visit_twitter_and_log_in

visit 'https://cards-dev.twitter.com/validator'

find('input.js-username-field').set(ENV['TWITTER_USERNAME'])

find('input.js-password-field').set(ENV['TWITTER_PASSWORD'])

click_on('Log in')

end

def enter_url_and_click_preview(url)

find('input.FormControl').set(url)

click_on('Preview card')

result = has_content?('Page fetched successfully')

visit 'https://cards-dev.twitter.com/validator'

end

end

That second method needs to be pinged a few times with some junk cache-busting. This is the method that calls it:

def enter_urls

urls.each do |url|

3.times do

enter_url_and_click_preview("#{url}?#{rand(10_000)}=#{rand(10_000)}")

end

enter_url_and_click_preview(url)

end

end

____________________________
Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.

7f5574 No.15788

Disclaimer: this post and the subject matter and contents thereof - text, media, or otherwise - do not necessarily reflect the views of the 8kun administration.



[Return][Go to top][Catalog][Nerve Center][Random][Post a Reply]
[]
[ / / / / / / / / / / / / / ] [ dir / random / 93 / biohzrd / hkacade / hkpnd / tct / utd / uy / yebalnia ]