ranking-challenge
ranking-challenge copied to clipboard
Return list of expanded URLs instead of just the string of only the first URL
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!
https://github.com/HumanCompatibleAI/ranking-challenge/blob/28b900e18b7aa44855309b2bbb164a2365ffc75d/sample_data/preprocessing.py#L186
# 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")]