Hi, I noticed in the line below the code only returns the first expanded URL (urls[0]), and returns it as a string. Often, there are multiple URLs, so it would be great if all expanded URLs in any given tweet were returned. See the suggestion below. Thanks!
|
expanded_url = urls[0].get('expanded_url', None) if urls else None |
# current: returns string and returns only the first expanded URL
expanded_url = urls[0].get("expanded_url", None) if urls else None
# suggestion: returns list of all expanded URLs
expanded_urls = [url.get("expanded_url") for url in urls if url.get("expanded_url")]