I'm using the Google Custom Search API, and for a specific purpose, I need to separate the social sites from the non-social ones. Here's my code:
for result in results:
omitSocials = ['instagram', 'twitter', 'facebook', 'amazon', 'linkedin', 'youtube', 'vimeo', 'google', 'pinterest']
#omitSocials = ['https://www.instagra', 'https://twitt', 'https://www.faceboo', 'https://www.pinterest',
#'https://business.faceboo', 'https://www.amazon', 'https://m.faceboo', 'https://vimeo',
#'https://www.youtu', 'https://play.google', 'https://support.goog']
urls = str(result.get('link'))
for social in omitSocials:
if social in urls:
print("="*10, f"Result", "="*10)
print(result.get('title'))
print(urls)
print(result.get('snippet'))
else:
pass
Output:
========== Result ==========
Pinch of Yum (@pinchofyum) ? Instagram photos and videos
https://www.instagram.com/pinchofyum/?hl=en
1m Followers, 226 Following, 2435 Posts - See Instagram photos and videos
from Pinch of Yum (@pinchofyum)
========== Result ==========
Pinch of Yum (pinchofyum) on Pinterest
https://www.pinterest.com/pinchofyum/
Pinch of Yum - 985.54k Followers, 446 Following, 54382 pins | Pinch of Yum - a
food blog with simple, tasty, and (mostly) healthy recipes.
========== Result ==========
Pinch of Yum (@pinchofyum) | Twitter
https://twitter.com/pinchofyum?lang=en
The latest Tweets from Pinch of Yum (@pinchofyum). Simple, tasty, and (mostly)
healthy recipes. Saint Paul, MN.
========== Result ==========
Pinch of Yum - Home | Facebook
https://www.facebook.com/pinchofyum/
Pinch of Yum, Minneapolis, MN. 354419 likes · 801 talking about this. Simple,
tasty, and (mostly) healthy recipes. Recipes:...
========== Result ==========
Pinch of Yum
https://www.youtube.com/channel/UC9ORxqKBywaO7fgflFJzHRw
Videos from Pinch of Yum - A food blog with simple, tasty, and (mostly) healthy
recipes. ... A food blog with simple and tasty recipes. https://pinchofyum.com/?.
But when I do the same thing for for social not in urls:
, I'm not getting the result without the social sites.
Every result (including the social ones) is occurring, but 9 times each!
Desired Output:
========== Result ==========
Pinch of Yum - A food blog with simple and tasty recipes.
https://pinchofyum.com/
... your food photography4 Behind the Scenes: 5 Time-Saving Tips for Food
Photography5 Our First Ever Tasty Food Photography Workshop · Pinch of Yum.
========== Result ==========
Recipes - Pinch of Yum
https://pinchofyum.com/recipes
Pinch of Yum is a food blog with hundreds of simple, healthy recipes to fit just
about any taste or diet. Find all our recipes here!
========== Result ==========
Lindsay Ostrom (@pinchofyum) Profile, Photos & Recipes | The ...
https://thefeedfeed.com/pinchofyum
We like to eat.
https://pinchofyum.tumblr.com/
Jun 22, 2013 ... pinchofyum, a blog on Tumblr. Never miss a post from pinchofyum. Make gifs,
join group chats, find your community. Only in the app.
========== Result ==========
pinchofyum | Healthy Aperture
https://healthyaperture.com/author/pinchofyum
A unique recipe discovery site curated by registered dietitians helping you find
the best healthy food blog recipes - including gluten free, vegan and more.
This output is the one I want to get, it does not include the socials.