File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -14,27 +14,27 @@ def __clean_urls(tweet):
1414 expanded_url = url ["expanded_url" ]
1515 index = url ["indices" ][0 ]
1616 display_url = url ["display_url" ]
17- if "status" and "twitter.com" in expanded_url :
17+ if "status" in expanded_url and "twitter.com" in expanded_url :
1818 text .insert (
1919 index ,
2020 f''' <br><br></p><blockquote class="twitter-tweet"><a href="{ expanded_url } "></a></blockquote><p class="article__text"><br><br> ''' )
21- elif 'youtu.be' or 'youtube' in expanded_url :
22- if 'watch' in url :
21+ elif 'youtu.be' in expanded_url or 'youtube' in expanded_url :
22+ if 'watch' in expanded_url :
2323 text .insert (
2424 index ,
2525 f''' <br><br><iframe width="500" height="300" src="{ expanded_url .replace ('watch?v=' ,'embed/' )} " frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe><br><br> ''' )
26- elif 'channel' or 'user' in expanded_url :
26+ elif 'channel' in expanded_url or 'user' in expanded_url :
2727 text .insert (
2828 index ,
29- f''' <br><br><a target="_blank" href="{ expanded_url } ">{ display_url } </a><br><br> ''' )
29+ f''' <br><br><a target="_blank" dir href="{ expanded_url } ">{ display_url } </a><br><br> ''' )
3030 else :
3131 text .insert (
3232 index ,
33- f'''<br><br><iframe width="500" height="300" src="https://www.youtube.com/embed/{ url .split ('/' )[- 1 ]} " frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe><br><br>''' )
33+ f'''<br><br><iframe width="500" height="300" src="https://www.youtube.com/embed/{ expanded_url .split ('/' )[- 1 ]} " frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe><br><br>''' )
3434 else :
3535 text .insert (
3636 index ,
37- f''' <br><br><a target="_blank" href="{ expanded_url } ">{ display_url } </a><br><br> ''' )
37+ f''' <br><br><a target="_blank" dir href="{ expanded_url } ">{ display_url } </a><br><br> ''' )
3838 tweet .full_text = '' .join (text )
3939
4040 except :
You can’t perform that action at this time.
0 commit comments