Showing posts with label Web. Show all posts
Showing posts with label Web. Show all posts

Tuesday, November 26, 2024

Scrape Pinterest Part 1


I am interested in writing a python script to webscrape my pinterest account and pull videos and Gifs from a date range. Pintertest does offer an API that does allow a Python script to do what I want. I even got Microsoft Copilot to generate a working script but using the API is really expensive. Therefore I found another article for that allows you to work around the API. See the following tutorial from Extracting Data from Pinterest using BeautifulSoup, Python. I also hope to use AI to put the downloaded pictures or video in folders for archiving. I wanted to do both in one script but I may have to do a separate script for training a model and organizing files into appropriate folders. Below is code that Microsoft Copilot genereated with a little editing from me.

#Write a python script that uses pinterest api to put pins into the correct board from the last seven days. If there is no board put the pin into the Unknown board.

import datetime, os

try:
    from pinterest_api import Pinterest
except:
    os.system("pip install pinterest-api")
    from pinterest_api import Pinterest

# Initialize Pinterest API
pinterest = Pinterest(access_token='@#$$%#@#')

# Get today's date and the date 7 days ago
today = datetime.datetime.now()
week_ago = today - datetime.timedelta(days=7)

# Get pins from the last 7 days
pins = pinterest.get_user_pins()

# Filter pins from the last 7 days
recent_pins = [pin for pin in pins if week_ago <= datetime.datetime.strptime(pin['created_at'], '%Y-%m-%dT%H:%M:%S') <= today]

# Function to add pin to board
def add_pin_to_board(pin, board_name):
    boards = pinterest.get_boards()
    board = next((board for board in boards if board['name'] == board_name), None)
   
    if board is None:
        # Create 'Unknown' board if it doesn't exist
        if board_name == 'Unknown':
            board = pinterest.create_board(name='Unknown', description='Pins without a specific board')
        else:
            print(f"Board '{board_name}' not found.")
            return
       
    pinterest.create_pin(board_id=board['id'], note=pin['note'], link=pin['link'], image_url=pin['image']['original']['url'])

# Iterate through recent pins and add them to the correct board or 'Unknown'
for pin in recent_pins:
    board_name = pin['board']['name'] if 'board' in pin else 'Unknown'
    add_pin_to_board(pin, board_name)

print("Pins have been organized.")

I did find a No-Code solution That I am planning to explore to make a browser bot:

Scrape Pinterest data without code

Downloading Media from Posts on X

 

We can download media from X using the followinf links

Just paste in the URL

The following tutorial show how to download videos and turn short ones to Gifs.

How to save a GIF from X, formerly known as Twitter

Monday, November 25, 2024

Tuesday, August 4, 2015

FrequentlyAskedQuestions - selenium - WebDriver FAQs - Browser automation framework - Google Project Hosting

The following is an excerpt from an article about testing web apps by automating web browsers.

Q: What is WebDriver?

A: WebDriver is a tool for writing
automated tests of websites. It aims to mimic the behaviour of a real
user, and as such interacts with the HTML of the application.




FrequentlyAskedQuestions - selenium - WebDriver FAQs - Browser automation framework - Google Project Hosting

Sunday, April 27, 2014

The Rasterbator

Turns an image into a poster!



The Rasterbator

Friday, April 18, 2014

Android App To Browse A Website - CodeProject

Good article on app for a particular web site. 



Android App To Browse A Website - CodeProject

Wednesday, April 2, 2014

Accessibility Checker: Test WCAG2 & Section 508 Compliance

Use the following link to  run automated check on web sites  for accessibility and code standards!

Accessibility Checker: Test WCAG2 & Section 508 Compliance

StatCounter - Free Invisible Web Tracker, Hit Counter and Web Stats

here is a service for collecting statistic for many websites and social media.

 StatCounter - Free Invisible Web Tracker, Hit Counter and Web Stats

Sunday, April 7, 2013

Embedding lua in web page on android - CodeProject

Introduction to article

Integrating a web server in android application can increase its flexibility, because it gives more interactive with other terminals. For web server, programmers need write web pages and these pages should be able to interoperate with host application. This article introduces an idea to embed lua in web page as dynamic language at server side and gives an example written based on starcore and SRPSHtmlEnvEngine, which is an embeddable web server supports http get and http post request.

Embedding lua in web page on android - CodeProject
Enhanced by Zemanta

Friday, July 15, 2011

cross-browser drag and drop - CodeProject

Drag and Drop Ltd LogoImage via WikipediaIntroduction to article

I could not find a good Drag and Drop JavaScript example that would work in all browsers. So I wrote one myself. I hope someone might find it useful. Please note that this example shows how to “capture” the element so that you don’t loose it if move outside of the element or outside of the browser window.


cross-browser drag and drop - CodeProject
Enhanced by Zemanta

Thursday, May 19, 2011

Blogger Buzz: Add a virtual tip jar to your blog

Here is a great article about how to add a virtual "tip" jar on a blog.

Blogger Buzz: Add a virtual tip jar to your blog
Enhanced by Zemanta

Sunday, February 13, 2011

Add Custom News to Website | Widgets Lab

Summary

The Niuzer widget allows you to create a custom news topic that will display up to 50 the latest, linked headlines. This widget is fully customizable with title options, text and border color options and widget size options. There are also commenting options built right into the widget. If you create an account with Niuzer, you will be able to engage with others on your specific topics!


Add Custom News to Website | Widgets Lab
Enhanced by Zemanta

Thursday, December 16, 2010

Silverlight Analytics Help You Track Users’ Experiences - CodeProject

Article Intro


Infragistics® Analytics Framework gives all of the Infragistics controls for Silverlight (both in their line of business and data visualization toolsets) support for the Microsoft Silverlight Analytics Framework (MSAF). Infragistics has gone farther than many other component vendors in implementing custom extensions for key controls that let you track the detailed user behaviors of these controls, and their framework has a lighter footprint that makes it easier to deploy with your Rich Internet Applications. You can learn more about the Infragistics Analytics Framework at www.infragistics.com, or right here as I walk you through some of its key features.
Read more about the superior Web Analytics for Silverlight supported by the Infragistics Analytics Framework.

Silverlight Analytics Help You Track Users’ Experiences - CodeProject
Enhanced by Zemanta

Tuesday, November 16, 2010

Connecting to the Web: I/O Programming in Android

This article explains how to use Android to make web connected applications that use XML


Connecting to the Web: I/O Programming in Android