docs/examples/data_connectors/OxylabsDemo.ipynb
<a href="https://colab.research.google.com/github/run-llama/llama_index/blob/main/docs/examples/data_connectors/OxylabsDemo.ipynb" target="_parent"></a>
Use Oxylabs Reader to get information from Google Search, Amazon and YouTube. For more information check out the Oxylabs documentation.
%pip install llama-index llama-index-readers-oxylabs
In this notebook, we show how Oxylabs readers can be used to collect information from different sources.
Firstly, import one of the Oxylabs readers.
Currently available readers are:
import os
from llama_index.readers.oxylabs import OxylabsGoogleSearchReader
Instantiate the reader with your username and password.
oxylabs_username = os.environ.get("OXYLABS_USERNAME")
oxylabs_password = os.environ.get("OXYLABS_PASSWORD")
google_search_reader = OxylabsGoogleSearchReader(
oxylabs_username, oxylabs_password
)
Prepare parameters. This example will load the Google Search results for the 'iPhone 16' query with the 'Berlin, Germany' location.
Check out the documentation for more examples.
results = google_search_reader.load_data(
{"query": "Iphone 16", "parse": True, "geo_location": "Berlin, Germany"}
)
print(results[0].text)
from llama_index.readers.oxylabs import OxylabsAmazonProductReader
amazon_product_reader = OxylabsAmazonProductReader(
oxylabs_username, oxylabs_password
)
results = amazon_product_reader.load_data(
{
"domain": "com",
"query": "B08D9N7RJ4",
"parse": True,
"context": [{"key": "autoselect_variant", "value": True}],
}
)
print(results[0].text)
from llama_index.readers.oxylabs import OxylabsYoutubeTranscriptReader
youtube_transcript_reader = OxylabsYoutubeTranscriptReader(
oxylabs_username, oxylabs_password
)
results = youtube_transcript_reader.load_data(
{
"query": "SLoqvcnwwN4",
"context": [
{"key": "language_code", "value": "en"},
{"key": "transcript_origin", "value": "uploader_provided"},
],
}
)
print(results[0].text)