Created
July 25, 2020 23:26
-
-
Save hamletbatista/8575b0659df172e188ae6725ef777e25 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from urllib.parse import urlparse | |
import re | |
url="https://www.amazon.com/SanDisk-128GB-microSDXC-Memory-Adapter/dp/B073JYC4XM/" | |
print(set(re.split("[/-]", urlparse(url).path))) | |
#output | |
#{'', 'B073JYC4XM', 'dp', '128GB', 'microSDXC', 'Memory', 'SanDisk', 'Adapter'} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
My two cents if I may :)
Different directories usually contain some context about the URL. If the first directory was
blog
for example, it would mean something different than if it appeared in last directory (part of the title for example).Query parameters also contain very useful information when present.
And so... the
url_to_df
function as born:What do you think?