Skip to content

Conversation

@alajv76-hub
Copy link

parser = argparse.ArgumentParser(description="Download from Pexels and post to Pinterest")
parser.add_argument("--query", required=True, help="Search query for Pexels")
parser.add_argument("--count", type=int, default=1, help="Number of items to fetch")
parser.add_argument("--use-hosting", action="store_true")
parser.add_argument("--include-attribution", action="store_true")
args = parser.parse_args()

photos = search_pexels(args.query, args.count)

if not photos:
    print("No photos found.")
    sys.exit(1)

for photo in photos:
    image_url = photo["src"]["original"]
    photographer = photo.get("photographer", "Unknown")
    pexels_link = photo.get("url", "")

    final_image_url = image_url

    if args.use_hosting:
        filename = f"temp_{int(time.time())}.jpg"
        download_file(image_url, filename)
        final_image_url = upload_to_imgur(filename)
        os.remove(filename)

    description = f"Photo about {args.query}"
    if args.include_attribution:
        description += f"\n📸 {photographer} via Pexels\n{pexels_link}"

    response = create_pin(
        image_url=final_image_url,
        title=f"{args.query.title()} Inspiration",
        description=description,
        alt_text=f"{args.query} image"
    )

    print("✅ Pin created:", response.get("id"))
    time.sleep(2)

At the moment we are not accepting contributions to the repository.

    parser = argparse.ArgumentParser(description="Download from Pexels and post to Pinterest")
    parser.add_argument("--query", required=True, help="Search query for Pexels")
    parser.add_argument("--count", type=int, default=1, help="Number of items to fetch")
    parser.add_argument("--use-hosting", action="store_true")
    parser.add_argument("--include-attribution", action="store_true")
    args = parser.parse_args()

    photos = search_pexels(args.query, args.count)

    if not photos:
        print("No photos found.")
        sys.exit(1)

    for photo in photos:
        image_url = photo["src"]["original"]
        photographer = photo.get("photographer", "Unknown")
        pexels_link = photo.get("url", "")

        final_image_url = image_url

        if args.use_hosting:
            filename = f"temp_{int(time.time())}.jpg"
            download_file(image_url, filename)
            final_image_url = upload_to_imgur(filename)
            os.remove(filename)

        description = f"Photo about {args.query}"
        if args.include_attribution:
            description += f"\n📸 {photographer} via Pexels\n{pexels_link}"

        response = create_pin(
            image_url=final_image_url,
            title=f"{args.query.title()} Inspiration",
            description=description,
            alt_text=f"{args.query} image"
        )

        print("✅ Pin created:", response.get("id"))
        time.sleep(2)
@github-actions
Copy link

At the moment we are not accepting contributions to the repository.

Feedback for Copilot.vim can be given in the feedback forum.

@github-actions github-actions bot closed this Jan 23, 2026
Copy link
Author

@alajv76-hub alajv76-hub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant