Da-unaloda Stainda Apa Rahula -2022- Hindi Filmyfly | Filmy4wap Filmywap

print(json.dumps(data, ensure_ascii=False, indent=2)) this feature into your existing project | Scenario | Integration steps | |----------|-------------------| | Existing Flask/Django API | 1. Copy the whole file into a module (e.g. movie_finder.py ). 2. Import search_movie inside a view/endpoint. 3. Return jsonify(search_movie(title)) . | | Desktop GUI (Tkinter / PyQt) | 1. Wire a “Search” button to search_movie(user_input) . 2. Populate a table/list with result["title"] , year , quality , and a clickable hyperlink ( result["url"] ). | | Home‑assistant / Node‑RED | 1. Expose the script via a lightweight HTTP server (e.g. uvicorn + FastAPI). 2. Call the endpoint from your automation flow and parse the JSON. | |

# ---------------------------------------------------------------------- # 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()

results.append( "source": "Filmywap", "title": title, "year": year, "language": language, "quality": quality, "url": href, ) return results

results.append( "source": "Filmy4wap", "title": title, "year": year, "language": language, "quality": quality, "url": href, ) return results print(json

# ---------------------------------------------------------------------- # 1️⃣ Helper – normalise user query # ---------------------------------------------------------------------- def normalize(text: str) -> str: """Lower‑case, strip accents, collapse whitespace, remove punctuation.""" text = unicodedata.normalize("NFKD", text) text = text.encode("ascii", "ignore").decode() text = re.sub(r"[^\w\s-]", "", text) # keep hyphens (some titles use them) text = re.sub(r"\s+", " ", text).strip() return text.lower()

# 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

class Filmy4wapScraper(BaseScraper): SEARCH_URL = "https://www.filmy4wap.in/search?q=query" Return jsonify(search_movie(title))

results.append( "source": "FilmyFly", "title": title, "year": year, "language": language, "quality": quality, "url": href, ) return results

# Sort by most‑popular (higher source_count) → higher quality quality_order = "4k": 4, "1080p": 3, "720p": 2, "480p": 1, None: 0 matches.sort( key=lambda x: ( -x["source_count"], -quality_order.get(x["quality"].lower() if x["quality"] else None, 0), ) )

with open(args.output, "w", encoding="utf-8") as f: json.dump(data, f, ensure_ascii=False, indent=2) ) matched_titles = title for title

@staticmethod def _get(url: str) -> requests.Response: """GET with a tiny retry loop.""" for _ in range(3): try: r = requests.get(url, headers=BaseScraper.HEADERS, timeout=12) r.raise_for_status() return r except requests.RequestException: continue raise RuntimeError(f"Failed to fetch url")

# Fuzzy fallback – we score against the **title** only. titles = [r["title"] for r in results] scored = process.extract( query_norm, titles, scorer=fuzz.token_sort_ratio, limit=None, ) matched_titles = title for title, score, _ in scored if score >= min_fuzzy return [r for r in results if r["title"] in matched_titles]