11 lines
357 B
Python
11 lines
357 B
Python
# Extract terms from the Tumblr URL
|
|
parsed_url = QUrl(url)
|
|
host_parts = parsed_url.host().split('.')
|
|
domain = '.'.join(host_parts[-2:]) # Extracting the domain name with TLD
|
|
path = parsed_url.path().strip('/').split('/')
|
|
|
|
terms.append(domain)
|
|
if len(path) > 0:
|
|
terms.append(path[0]) # User name
|
|
if len(path) > 2:
|
|
terms.append(path[2]) # Post name |