Skip to content

Instantly share code, notes, and snippets.

View arslandevs's full-sized avatar
:octocat:
Bravo !

Syed Arsalan Amin arslandevs

:octocat:
Bravo !
View GitHub Profile
@arslandevs
arslandevs / default.md
Created June 22, 2025 08:12 — forked from cablej/default.md
Cluely System prompt

<core_identity> You are an assistant called Cluely, developed and created by Cluely, whose sole purpose is to analyze and solve problems asked by the user or shown on the screen. Your responses must be specific, accurate, and actionable. </core_identity>

<general_guidelines>

  • NEVER use meta-phrases (e.g., "let me help you", "I can see that").
  • NEVER summarize unless explicitly requested.
  • NEVER provide unsolicited advice.
  • NEVER refer to "screenshot" or "image" - refer to it as "the screen" if needed.
  • ALWAYS be specific, detailed, and accurate.
import scrapy
from scrapy_playwright.page import PageMethod
from scrapy.selector import Selector
class QuotesSpider(scrapy.Spider):
name = 'quotes'
def start_requests(self):
yield scrapy.Request(
url="http://quotes.toscrape.com/scroll",
<div class="quote" itemscope="" itemtype="http://schema.org/CreativeWork">
<span class="text" itemprop="text"
>“It takes a great deal of bravery to stand up to our enemies, but just as
much to stand up to our friends.”</span
>
<span
>by <small class="author" itemprop="author">J.K. Rowling</small>
<a href="/author/J-K-Rowling">(about)</a>
</span>
<div class="tags">
import scrapy
from scrapy_playwright.page import PageMethod
class QuotesSpider(scrapy.Spider):
name = "quotes_pagination"
allowed_domains = ["quotes.toscrape.com"]
current_page = 1
start_urls = [
from scrapy import cmdline
from datetime import datetime
import os
def start_crawl():
os.chdir("/Users/arsalanamin/hustle/github/scrapy_infinite_scroll")
try:
print(f"======SCRAPPED AT {datetime.now()}========")
def start_requests(self):
yield scrapy.Request(
url="http://quotes.toscrape.com/scroll",
meta={
"playwright": True,
"playwright_page_methods": [
PageMethod("wait_for_selector", "div.quote")
],
"playwright_include_page": True
},
async def parse(self, response):
try:
page = response.meta['playwright_page']
# READ CONTENT OF 10 SCROLLS
for i in range(2, 11): # 2 to 10
await page.evaluate("window.scrollBy(0, document.body.scrollHeight)")
quotes_count = 10*i
await page.wait_for_selector(f'.quote:nth-child({quotes_count})')
def custom_headers(
browser_type: str,
playwright_request: Request,
scrapy_headers: Headers,
) -> dict:
return {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36 Edg/113.0.1774.35"}
PLAYWRIGHT_PROCESS_REQUEST_HEADERS = custom_headers
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import json
from models.machine import Inserttable, db

def create_logic():
    try:
        # create tables if not exists.
        db.create_all()
        db.session.commit()
        return '==================TABLES CREATED=================='