scraping5.py
The Instagram scraping script that collects reel data from thehistoriaparagandules profile.
Main Components
The main Instaloader instance used to authenticate and access Instagram data.
The Instagram profile username to scrape data from.
Data Collection
The script iterates through all posts from the profile and filters video content (reels). For each video post, it extracts:Post date in
YYYY-MM-DD HH:MM:SS formatCaption text of the reel (or “Sin texto” if none)
Number of likes on the post
Number of comments on the post
Direct URL to the video file
View count for the video
Video duration in seconds
Instagram post URL in format
https://www.instagram.com/p/{shortcode}/Output
The script saves all collected data toinformacion_reels_simple.csv with UTF-8 encoding.
mapita5.py
Generates an interactive map visualization of Instagram reel locations using Folium.Functions
obtener_coordenadas()
Coordinate string in format
"latitude,longitude"(lat, lon) as floats, or (None, None) if parsing fails.
Example:
descargar_imagen()
Direct URL to the image file
Unique identifier for the image filename
imagenes/imagen_{index}.jpg) or None if download fails.
Behavior:
- Creates
imagenes/directory if it doesn’t exist - Downloads images in chunks of 1024 bytes
- Handles HTTP errors gracefully
Map Configuration
Initial map center coordinates [latitude, longitude] - centered on Canary Islands
Initial zoom level for the map
Marker Popups
Each marker displays:- First word of the reel caption as title
- Thumbnail image (200px width, auto height)
- Link to Instagram post
Output
Saves interactive HTML map tomapa_ubicaciones_reels_with_thumbnails.html
Data Analysis (EDA.ipynb)
The exploratory data analysis notebook provides statistical insights.Key Metrics
- Average Likes: ~1,316 per post
- Average Comments: ~39 per post
- Average Views: ~15,392 per post
- Average Duration: ~50 seconds
Categories
Content is categorized into:- Toponimia de Lugares (Place Names)
- Curiosidades Históricas (Historical Curiosities)
- Biografías de Personajes Históricos (Historical Biographies)
- Arquitectura (Architecture)
- Acontecimientos Históricos (Historical Events)