class Filmy4wapScraper(BaseScraper): SEARCH_URL = "https://www.filmy4wap.in/search?q=query"
results.append( "source": "Filmy4wap", "title": title, "year": year, "language": language, "quality": quality, "url": href, ) return results ) return results with open(args.output
with open(args.output, "w", encoding="utf-8") as f: json.dump(data, f, ensure_ascii=False, indent=2) encoding="utf-8") as f: json.dump(data
@classmethod def search(cls, query: str) -> List[Dict[str, Any]]: url = cls.SEARCH_URL.format(query=query.replace(" ", "-")) soup = BeautifulSoup(cls._get(url).text, "html.parser") cards = soup.select("article.movie-item") results = [] for c in cards: a = c.select_one("h3 a") if not a: continue title = a.get_text(strip=True) href = cls._clean_link(a["href"]) indent=2) @classmethod def search(cls
# ---------------------------------------------------------------------- # 5️⃣ Command‑line interface (nice for quick testing) # ---------------------------------------------------------------------- if __name__ == "__main__": import argparse parser = argparse.ArgumentParser( description="Search Hindi movies on FilmyFly / Filmy4wap / Filmywap." ) parser.add_argument( "title", nargs="+", help="Movie title (e.g. 'Da-unaloda stainda apa rahula 2022 hindi')", ) parser.add_argument( "-o", "--output", default="movie_search_result.json", help="File to write JSON output to (default: %(default)s)", ) args = parser.parse_args()
return "query": query, "normalized_query": query_norm, "total_matches": len(matches), "results": matches,
# Year & language are usually in a <p> like "2022 | Hindi | 720p" meta = c.select_one("p.movie-meta") year, language, quality = None, None, None if meta: parts = [p.strip() for p in meta.get_text(separator="|").split("|")] for p in parts: if re.fullmatch(r"\d4", p): year = p elif p.lower() in "hindi", "english", "telugu", "marathi": language = p else: quality = p