Closed narayanan-ka closed 1 year ago
Hi@meyt The useragent bot changes recommended aren't already part of the package ? I saw code for Twitter card too, are they for something else ?
@narayanan-ka No, you must set it manually.
@narayanan-ka No, you must set it manually.
Understood. I need to replace the headers with the one you recommended or write a if condition for Twitter specially to use a header ?
Another question : I saw code for Twitter already in the package , any specific reason headers weren't updated for us to put it out manually ?
@narayanan-ka The TwitterCard is related to meta tag standard defined by Twitter.
Using header or any other tricks to have successful requests need a lot of effort. I can't maintain such stuff.
@narayanan-ka The TwitterCard is related to meta tag standard defined by Twitter.
Using header or any other tricks to have successful requests need a lot of effort. I can't maintain such stuff.
Well ok. Will the header user agent (Google bot) you recommended in the post for Twitter work for other links ? If yes, I can bypass the if condition to use only 1 header.
@narayanan-ka Yes
Hi @meyt. I'm on Django-REST API 3.2 , using postman the results of link preview are as follows :
For twitter:
{ "site_name": "Twitter", "title": "JavaScript is not available.", "description": "We’ve detected that JavaScript is disabled in this browser. Please enable JavaScript or switch to a supported browser to continue using twitter.com. You can see a list of supported browsers in our Help Center.", "image": null, "absolute_image": null, "force_title": "JavaScript is not available." }
For Links other than twitter:
{ "site_name": "The Verge", "title": "Two years later, Netflix is still experimenting with games", "description": "Netflix has become a serious video game publisher.", "image": "https://cdn.vox-cdn.com/thumbor/BOil0LlEqGz5gPj4LO_zTGDElf0=/0x0:1920x1080/1200x628/filters:focal(754x440:755x441)/cdn.vox-cdn.com/uploads/chorus_asset/file/24814361/oxenfreequeens_gambit.png", "absolute_image": "https://cdn.vox-cdn.com/thumbor/BOil0LlEqGz5gPj4LO_zTGDElf0=/0x0:1920x1080/1200x628/filters:focal(754x440:755x441)/cdn.vox-cdn.com/uploads/chorus_asset/file/24814361/oxenfreequeens_gambit.png", "force_title": "Two years later, Netflix is still experimenting with games" }
For Twitter , I'm getting Javascript not available , Anything that I'm missing ?
You helped me to convert the link_preview(link).to_dict() the other day for Serialization. The results are as above.