Created
May 8, 2026 12:45
-
-
Save BexTuychiev/38e6bad25a5506aaa2e92eaf51d02677 to your computer and use it in GitHub Desktop.
Firecrawl /interact: multi-step navigation against a Hugging Face model page
This file contains hidden or 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
| """A multi-step navigation flow against a Hugging Face model page. | |
| The shape: one scrape opens the live session on the model card. Two further | |
| interact calls reuse that session to navigate to the Files tab and the Community | |
| tab and pull data each tab renders. The browser is the same browser across all | |
| three calls — page state and history carry over. | |
| Target: Qwen/Qwen2.5-7B-Instruct (popular, public, no gate). | |
| """ | |
| import os | |
| from dotenv import load_dotenv | |
| from firecrawl import Firecrawl | |
| load_dotenv() | |
| app = Firecrawl(api_key=os.getenv("FIRECRAWL_API_KEY")) | |
| result = app.scrape( | |
| "https://huggingface.co/Qwen/Qwen2.5-7B-Instruct", | |
| formats=["markdown"], | |
| ) | |
| scrape_id = result.metadata.scrape_id | |
| print(f"scrape_id={scrape_id}\n") | |
| # 1. Click into the Files tab and list the top files with their sizes. | |
| files = app.interact( | |
| scrape_id, | |
| prompt=( | |
| "Click the 'Files' tab in the model navigation. Once the file list " | |
| "renders, return the names and sizes of the top 5 files at the repo " | |
| "root as a JSON list." | |
| ), | |
| ) | |
| print("Files tab:") | |
| print(files.output) | |
| # 2. Reuse the same session: navigate to the Community tab. | |
| community = app.interact( | |
| scrape_id, | |
| prompt=( | |
| "Click the 'Community' tab. Once the discussion list renders, return " | |
| "the titles and reply counts of the top 3 discussion threads as a JSON list." | |
| ), | |
| ) | |
| print("\nCommunity tab:") | |
| print(community.output) | |
| app.stop_interaction(scrape_id) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment