feat: add a transcription tool family (Facebook Ads, YouTube, media) - #43
Open
steadyfetch wants to merge 1 commit into
Open
steadyfetch wants to merge 1 commit into
steadyfetch wants to merge 1 commit into
Conversation
The package covers what a page or profile shows; it has no tool for what is
said inside a video or audio file. An agent asked for the script of an ad,
the words in a YouTube video or the text of a podcast episode has to fall
back to ApifyActorsTool and know an Actor ID.
Three classes, shaped on the existing third-party wrappers:
- ApifyFacebookAdsTranscriptTool -> steadyfetch/facebook-ads-transcript-scraper
- ApifyYouTubeTranscriptTool -> steadyfetch/youtube-transcript-scraper
- ApifyMediaTranscriberTool -> steadyfetch/media-transcriber
They go through ApifyToolsClient, return the standard {"run", "items"}
envelope, clamp max_results through the base class, and are exported as
APIFY_TRANSCRIPT_TOOLS. The three Actors are pay-per-event and published by
steadyfetch; no price is named in the code, since a released package cannot
be edited when one changes.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this adds
A fourth tool family: transcription. Three classes, exported together as
APIFY_TRANSCRIPT_TOOLS.ApifyFacebookAdsTranscriptToolsteadyfetch/facebook-ads-transcript-scrapersearch_queries: list[str],country: str = "US",max_resultsApifyYouTubeTranscriptToolsteadyfetch/youtube-transcript-scrapervideo_urls: list[str],max_resultsApifyMediaTranscriberToolsteadyfetch/media-transcriberurls: list[str],max_resultsWhy
The existing families return what a page or a profile shows. None of them returns what is said inside a video or an audio file. An agent asked for the script of an ad it just found, the words in a YouTube video, or the text of a podcast episode has to drop to
ApifyActorsTooland already know an Actor ID — so the capability is invisible to tool selection.The three Actors are pay-per-event Actors we publish as
steadyfetch, alongside the six third-party Actors already wrapped here (clockworks/tiktok-scraper,apimaestro/linkedin-profile-posts,harvestapi/linkedin-profile-search,apidojo/twitter-scraper-lite,compass/crawler-google-places,streamers/youtube-scraper). A run is charged to the caller's own Apify account at the price on each Actor's store page; no price appears anywhere in the code, since a released package cannot be corrected when one changes.Shape
Modelled on
tools/social.py— same input-schema style, same docstring and description shape, same_ApifyGenericToolenvelope contract ({"run": {...}, "items": [...]}), Actor calls throughApifyToolsClientrather than the SDK, defaults in_constants.py, no newapify_api_tokenfield, no hand-edited version or changelog.Two small deliberate choices:
max_resultsbounds the Actor's own work as well as the dataset read (maxAds/searchMaxAdsandmaxItems), so a clamped call cannot cost more than the caller asked for. It defaults to 10 rather than the social family's 20 because these Actors charge per delivered item.ValueErrorclient-side (surfacing asToolException).videoUrlsandurlsboth carry a sample-run default on the Actor side, so an empty list would silently run a demo instead of failing.Tests
tests/unit_tests/test_transcript_tools.py— 38 new tests: client-level run-input mapping per Actor, the empty-list guards, per-tool happy path, clamping,RuntimeError/ValueError→ToolException, empty datasets, datetime serialisation, envelope shape, and a check that no description carries a price.tests/unit_tests/test_merge_surface.pyis extended with the new group (size, disjointness, globally unique tool names).ruff check,ruff format --check,mypy,codespellandscripts/check_imports.pyall clean.Note, unrelated to this PR
While checking what user-agent the package sends:
_create_apify_clientappends; Origin/langchainby reaching forhttp_client.httpx_client/http_client.http_client, butapify-client2.5.1 (inside the declared>=2.3.0,<3.0.0range) exposesimpit_clientinstead. Bothgetattrlookups returnNone, so the suffix is silently dropped and runs from this package are indistinguishable from any otherApifyClientcaller. Happy to open a separate issue or PR for it.