Пример #1
0
def qpsru(url):
    return pyshorteners.Shortener().qpsru.short(url)
def urlshortener():
    urladdress = url.get()
    url_short = pyshorteners.Shortener().tinyurl.short(urladdress)
    url_address.set(url_short)
Пример #3
0
import pyshorteners

short = pyshorteners.Shortener()

print(" { URL Shortener by belux }")
url = input("Your URL : ")
hasil = short.tinyurl.short(url)
print("Output : " + hasil)
Пример #4
0
import telebot, py1337x
from tpblite import TPB
from aiohttp import web
from models import dbQuery

# Finding the absolute path of the config file
scriptPath = path.abspath(__file__)
dirPath = path.dirname(scriptPath)
configPath = path.join(dirPath,'config.json')

config = json.load(open(configPath))
language = json.load(open(config['language']))
dbSql = dbQuery(config['database'])
torrent = py1337x.py1337x(proxy='1337x.to', cache=config['cache'], cacheTime=config['cacheTime'])
pirateBay = TPB()
shortner = pyshorteners.Shortener()
bot = telebot.TeleBot(config['botToken'], parse_mode='HTML')

# Configuration for webhook
webhookBaseUrl = f"https://{config['webhookOptions']['webhookHost']}:{config['webhookOptions']['webhookPort']}"
webhookUrlPath = f"/{config['botToken']}/"

app = web.Application()

# Process webhook calls
async def handle(request):
    if request.match_info.get('token') == bot.token:
        request_body_dict = await request.json()
        update = telebot.types.Update.de_json(request_body_dict)
        bot.process_new_updates([update])
        return web.Response()
Пример #5
0
def short(url):
    return pyshorteners.Shortener().tinyurl.short(url)
Пример #6
0
def urlshorten(url):
    s=pyshorteners.Shortener()
    return s.tinyurl.short(url)
Пример #7
0
 def __init__(self, bot):
     self.bot = bot
     self.short = pyshorteners.Shortener().tinyurl.short
     self.board_loop.start()
     self.quest_loop.start()
Пример #8
0
import pyshorteners

link = input("enter the link:")  # variable
shortener = pyshorteners.Shortener()  # class object

x = shortener.tinyurl.short(link)  # shorting the link

print(x)
Пример #9
0
opti_addy = []
for address in dirs[0]['legs']:
    opti_addy.append(address['start_address'])
opti_addy.append(opti_addy[0])
opti_addy = [i.replace('#', 'Apt ') for i in opti_addy
             ]  # replaces '#' with 'Apt ' (# breaks google url)

print('\n', '*** Addresses succesfully organized for optimal route. ***', '\n')

for number, address in enumerate(opti_addy):
    print(str(number) + '.' + '   ', address)

addy_link = '/'.join(opti_addy)
goog_link = 'https://www.google.com/maps/dir/'
full_link = goog_link + addy_link
b_link = full_link.replace(' ', '+')

# Bitly Link Feature
bitly_key = 'BITLY API KEY GOES HERE'
s = pyshorteners.Shortener(Shorteners.BITLY, bitly_token=bitly_key)
shorturl = s.short(b_link)
pyperclip.copy(shorturl)
print()
print('Google Maps link: ', shorturl)
print()
print('*** Google Maps link copied to clipboard. Paste in webrowser. ***')
print()

input("Press the <ENTER> key to exit...")
quit()
Пример #10
0
file_obj.close()

#%% Yazım kılavuzu

from textblob import textblob

text = TextBlob("he is my favrote hero")
print(text.correct())

#%% URL kısaltıcı

import pyshorteners

link = 'https://www.instagram.com/p/CD5pxxAgr2n/'

print(pyshorteners.Shortener().clckru.short(link))

#%% Whatsapp mesajı atan uygulama

import pywhatkit as kit

kit.sendwhatmsg("+905*******", "Selam kardeş", 11, 32)

#%% sistem ekipmanlarını ğrenme kafası

import platform
my_system = platform.uname()
print(f"System: {my_system.system}")
print(f"Node Name: {my_system.node}")
print(f"Release: {my_system.release}")
print(f"Version: {my_system.version}")
Пример #11
0
import random
import pyshorteners
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
from io import BytesIO
from bs4 import BeautifulSoup as soup
from random import randint
from telebot.types import InlineKeyboardMarkup, InlineKeyboardButton
from telebot.types import InputMediaPhoto
from telebot import types
from selenium import webdriver
'''from selenium.webdriver.firefox.options import Options
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary'''

chilp_it = pyshorteners.Shortener()
#token = os.environ.get("bot_api")
token = "1324074534:AAH2WfmQT0M-Iv_H46iO0fz6qVStuvqeLY4"
bot = telebot.TeleBot(token)

chrome_options = webdriver.ChromeOptions()
chrome_options.binary_location = os.environ.get("CHROME_BIN")
chrome_options.add_argument("--headless")
chrome_options.add_argument('--disable-dev-shm-usage')
chrome_options.add_argument('--no-sandbox')
browser = webdriver.Chrome(executable_path=os.environ.get("CHROME_PATH"),
                           chrome_options=chrome_options)
'''options = Options()
options.headless = False
#req = requests.get("https://w11.mangafreak.net/Search/" + str(query), headers = {"User-Agent" : "Mozilla/5.0", 'x-requested-with': 'XMLHttpRequest'})
browser = webdriver.Firefox(options=options, executable_path="D:\instabot\instabot\geckodriver.exe")'''
Пример #12
0
def get_short_url(url):
    """Укорачивает ссылку."""
    import pyshorteners
    s = pyshorteners.Shortener()
    return s.tinyurl.short(url)
Пример #13
0
def short():
    url = entry_url.get()
    shorted_url = pyshorteners.Shortener()
    showinfo("Shorted url", f"{shorted_url.tinyurl.short(url)}")
    clipboard.copy(f"{shorted_url.tinyurl.short(url)}")
import pyshorteners

url = input("Enter URL = \n")

print("URL after shortening = ", pyshorteners.Shortener().tinyurl.short(url))
Пример #15
0
def changeScreens(cardID):
    """Changes the screen shown on the Raspberry Pi Hat.

    Checks to see if the card is in the database and displays
    the corresponding screen.

    We are using the inkywHAT Red/Black/White:
    https://shop.pimoroni.com/products/inky-what?variant=13590497624147 

    Documentation:
    https://github.com/pimoroni/inky 

    TODO: Change the screen back to "please scan card" after a set amount of time has passed. 
    Needs some multithreading or something to accomplish that I think.
    """
    
    ######## Pi Hat Setup ########
    print("Changing screens...")

    inkywhat = InkyWHAT('black')
    
    # Establish a new connection for checking if the card is in the DB.
    # Not sure if this is required, but this is the easiest way I could find to do it.
    # Copy-pasted from the earlier mqtt_connection variable.
    pi_hat_connection = mqtt_connection_builder.mtls_from_path(
        endpoint=args.endpoint,
        cert_filepath=args.cert,
        pri_key_filepath=args.key,
        client_bootstrap=client_bootstrap,
        ca_filepath=args.root_ca,
        client_id=args.client_id,
        clean_session=False, 
        keep_alive_secs=6)

    # Query the DB to see if that card is in it.
    # Use the config defined at the top of the file to hide connection information.
    cardInDBResult = False
    try:
        mysqlConn = mysql.connector.connect(host=config['database']['dbHostname'],
                                            database=config['database']['dbName'],
                                            user=config['database']['dbUsername'],
                                            password=config['database']['dbPassword'])
        if mysqlConn.is_connected():
            print("Connected to database...")
            cursor = mysqlConn.cursor()
            cursor.execute("select database();")
            record = cursor.fetchone()
            lookForCardQuery = "SELECT * FROM Student_ID WHERE SID = " + str(cardID)
            cursor.execute(lookForCardQuery)
            records = cursor.fetchall()
            if(cursor.rowcount > 0):
                cardInDBResult = True
    except Error as e:
        print("Error while connecting to MySQL Database", e)
    finally:
        if (mysqlConn.is_connected()):
            cursor.close()
            mysqlConn.close()
            print("Disconnected from database...")

    # If the card is in the database, set the screen to be shown to the "Welcome" screen
    if (cardInDBResult):
        print("ID Found - Displaying Welcome...")
        imgURL = "../../../qrcode/displayScreens/welcome_bw.png"
        im = Image.open(imgURL)

        # Resizing the image so it fits to the screen
        # This is specific to the inkywhat, otherwise it claims that there is a size-mismatch.
        size = (400,300)
        out = im.resize(size)
        out.save('../../../qrcode/resize-output.png')
        img = Image.open('../../../qrcode/resize-output.png')
        pal_img = Image.new("P", (1, 1))
        pal_img.putpalette((255, 255, 255, 0, 0, 0, 255, 0, 0) + (0, 0, 0) * 252)
        img = img.convert("RGB").quantize(palette=pal_img)
        
    # If the card is not in the database, make a QR code and show the "QR Code" screen
    elif (not cardInDBResult):
        print("ID Not Found - Displaying Registration...")
        imgURL = "../../../qrcode/displayScreens/qrscan_bw.png"
        displayURL = "../../../qrcode/qrCodeScreenMerged.png"

        # Generate a QR Code Object
        qr = qrcode.QRCode(
            version=None,
            error_correction=qrcode.constants.ERROR_CORRECT_L,
            box_size=3,
            border=2,
        )

        # Generate the URL the code points to and add it to the QR Code
        wURL = config['aws_endpoints']['registrationSite'] + str(cardID)
        qr.add_data(wURL)
        qr.make(fit=True)
        img = qr.make_image(fill_color="black", back_color="white")

        # Save the generated QR Code to the proper folder
        img.save('../../../qrcode/qr_image.png')
        im = Image.open(imgURL)

        # Resizing the image so it fits to the screen
        size = (400,300)
        out = im.resize(size)
        out.save('../../../qrcode/resize-output.png')

        # We are using ImageMagick installed on the Raspberry Pi to 
        # composite our generated QR Code onto the premade image
        # with this subprocess call. This could be changed to a 
        # bash script called in the same way.
        s = pyshorteners.Shortener(Shorteners.TINYURL)
        shortLink = s.short(wURL)
        composeQRCodeOntoImageCommand = 'composite -blend 100 -gravity center ../../../qrcode/qr_image.png ../../../qrcode/resize-output.png ../../../qrcode/qrCodeScreenMerged.png'
        composeURLOntoImageCommand = 'convert ../../../qrcode/qrCodeScreenMerged.png -gravity North -pointsize 24 -annotate +0+215 \'' + shortLink + '\' ../../../qrcode/qrCodeScreenMerged.png'
        subprocess.call(composeQRCodeOntoImageCommand, shell=True)
        subprocess.call(composeURLOntoImageCommand, shell=True)

        img = Image.open(displayURL)

        # Continue resizing, inkywhat complains otherwise.
        pal_img = Image.new("P", (1, 1))
        pal_img.putpalette((255, 255, 255, 0, 0, 0, 255, 0, 0) + (0, 0, 0) * 252) 
        img = img.convert("RGB").quantize(palette=pal_img)

    # Update the image on the screen and show it.
    inkywhat.set_image(img)
    inkywhat.set_border('white')
    inkywhat.show()
    print("Finished changing screens...")
Пример #16
0
import pyshorteners

#Jav Code
X = "\033[0;37;40m"
DG = "\033[1;30;40m"
R = "\033[1;31;40m"
G = "\033[1;32;40m"
Y = "\033[1;33;40m"
B = "\033[1;34;40m"
M = "\033[1;35;40m"
C = "\033[1;36;40m"
W = "\033[1;37;40m"
shortme = pyshorteners.Shortener()

print(W + "    [" + R + "+" + W + "]     URL Shortener    [" + R + "+" + W +
      "]")
print(W + "    [" + R + "+" + W + "] Subscribe " + Y + "Mbah beluk" + W +
      " [" + R + "+" + W + "]\n")
url = input("Your URL " + R + "> " + W)
fake = input("Fake URL " + R + "> " + W)
print("Contoh " + R + ":" + W + " how-to-get-free-coin")
rantai = input("Rantai url " + R + "> " + W)
hasil = shortme.tinyurl.short(url)
tanpahttp = hasil[7:]
print("Your link " + R + ": " + Y + fake + "-" + rantai + "@" + tanpahttp + X)
Пример #17
0
__author__ : "@rockdevu"

# This program is used to shorten the URLs.

import pyshorteners as short

url = input("Please enter the URL : ")

s = short.Shortener()

print("Your link is ready : ",s.tinyurl.short(url))
Пример #18
0
def tinyfy():
    shortener = pyshorteners.Shortener()
    response = {'short_url': shortener.tinyurl.short(request.form['urlField'])}
    print(response['short_url'])
    return jsonify(response)
Пример #19
0
from telegram.ext.dispatcher import run_async
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters, ConversationHandler, CallbackQueryHandler, InlineQueryHandler
import telegram
from telegram import InlineKeyboardButton, InlineKeyboardMarkup, InputTextMessageContent, InlineQueryResultArticle
import logging
import os
import unshortenit
from unshortenit import UnshortenIt
import pyshorteners
import re
from uuid import uuid4

Api_key = os.environ.get("api_key", "df873189c1a48c8faf7a0dac0849040c84c0fa1a")
s = pyshorteners.Shortener(api_key=Api_key)

logging.basicConfig(
    format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
    level=logging.INFO)

logger = logging.getLogger(__name__)


@run_async
def start(update, context):
    first = update.message.chat.first_name
    update.message.reply_text(
        'Hi! ' + str(first) +
        ' \n\nWelcome to Url Shortener Bot\n\n 🔌This Bot Was Made By: @levi_dev \n\n 💡Send Any Url Below Make Sure The Url Starts With http:// or https://.'
    )

Пример #20
0
def shorten(url):
    lurl = pyshorteners.Shortener()
    return lurl.tinyurl.short(url)
Пример #21
0
def shorten(url):
    link = pyshorteners.Shortener()
    return link.tinyurl.short(url)
Пример #22
0
def url_shorter():
    shorter_url = pyshorteners.Shortener().tinyurl.short(entry1.get())
    txt.delete("1.0", "end")
    txt.insert(0.0, str(shorter_url))
Пример #23
0
def starlink_action(action: str) -> str:
    """
    Given a driver and a action [lock, unlock], go ahead and login to starlink and perform the action
    Returning back a string with the actions return message
    :param action:
    :return:
    """

    # ------------------------------------------------------------------------------------------------------

    shortener = pyshorteners.Shortener()

    # ------------------------------------------------------------------------------------------------------

    # environment variable for subaru starlink PIN
    PIN = os.environ.get("PIN")

    # environment variable for subaru starlink security question and answers
    security_questions_and_answers = {}
    for qa in os.environ.get("SECURITY_Q&A").split(","):
        question, answer = qa.split(":")
        security_questions_and_answers[question] = answer

    username = os.environ.get("USERNAME")
    password = os.environ.get("PASSWORD")

    text_number = os.environ.get("PHONE_NUMBER")

    # ------------------------------------------------------------------------------------------------------

    options = Options()
    options.binary_location = "lambda/headless-chromium"
    options.add_argument("--headless")
    options.add_argument("--no-sandbox")
    options.add_argument("--single-process")
    options.add_argument("--disable-dev-shm-usage")

    # Optional argument, if not specified will search path.
    driver = webdriver.Chrome("lambda/chromedriver", options=options)

    print(f"Processing {action} action..")
    if action not in ["lock", "unlock", "locate"]:
        sys.exit("Unsupported action provided!")

    # ------------------------------------------------------------------------------------------------------

    # Process the initial login steps
    login_to_starlink(driver, security_questions_and_answers, username,
                      password)

    # ------------------------------------------------------------------------------------------------------

    print("Waiting on action buttons..")
    starlink_action_button_xpath = (
        f'//div[@id="starlinkActions"]//div[@id="{action}Button"]')
    WebDriverWait(driver, 10).until(
        EC.element_to_be_clickable((By.XPATH, starlink_action_button_xpath)))

    # Find the lock/unlock button
    print("Pressing action button..")
    starlink_button = driver.find_element_by_xpath(
        starlink_action_button_xpath)
    starlink_button.click()

    pin_box = driver.find_element_by_xpath(
        '//form[@id="starlinkOptionsForm"]//input[@id="pin"]')
    pin_box.send_keys(f"{PIN}\n")

    # ------------------------------------------------------------------------------------------------------

    if action in ["lock", "unlock"]:
        # Return back the status message from Subaru
        status_message_xpath = '//div[@id="starlinkActions"]//div[@role="alert"]/*/span[@class="statusMessage"]'

        # Wait for status message
        WebDriverWait(driver, 20).until(
            EC.visibility_of_element_located((By.XPATH, status_message_xpath)))

        status_message = driver.find_element_by_xpath(status_message_xpath)
        status_message_text = status_message.text

        print(f"Status: '{status_message_text}'")

        if text_number:
            send_to_sns(status_message_text, text_number)

    elif action == "locate":
        located_message_xpath = '//div[@id="map_canvas"]'

        # Wait for located successful message
        WebDriverWait(driver, 45).until(
            EC.visibility_of_element_located(
                (By.XPATH, located_message_xpath)))

        google_maps_navigate_button = driver.find_element_by_xpath(
            '//div[@class="map-location__action actionOnMap"]/img[@alt="Nav"]')
        google_maps_navigate_button.click()

        # switch to the google maps window and get the url
        driver.switch_to.window(driver.window_handles[1])

        current_url = driver.current_url
        shortened_url = shortener.tinyurl.short(current_url)

        print(f"Shortened from {current_url} to {shortened_url}")

        if text_number and shortened_url and current_url:
            send_to_sns(shortened_url, text_number)

    return "Completed Starlink Action"
Пример #24
0
import pyshorteners as ps

url = "https://docs.djangoproject.com/en/3.1/intro/tutorial02/"

u = ps.Shortener().tinyurl.short(url)
print(u)
Пример #25
0
import pyshorteners
url = input("Enter your URL-->")
s = pyshorteners.Shortener().tinyurl.short(url)
print("Your shorted URL is -->", s)

def process_reponse(response, country, numOfAdults, numOfInfants,
                    numOfChildren, fromDate, toDate, durationOfStay,
                    telegramChatID, telegramChannel):
    stringResponse = "<u><b>Your search criteria</b></u>\n" + "City: " + country + "\nAdults: " + str(
        int(numOfAdults)
    ) + "\nInfants: " + str(int(numOfInfants)) + "\nChildren: " + str(
        int(numOfChildren)
    ) + "\nFrom: " + fromDate + "\nTo: " + toDate + "\nDuration of stay(days): " + str(
        durationOfStay) + "\n\n"
    stringResponse = stringResponse + "Here are your 5 most recommended listings...\n"
    i = 1
    s = pyshorteners.Shortener()
    for listing in response:
        print("Retrieving next coords...")
        listingDetails = response[listing]
        print("Shortening URL...")
        convertedURL = False
        while convertedURL == False:
            try:
                url = s.tinyurl.short(listingDetails['url'])
                convertedURL = True
                print("Successfully converted URL...")
            except Exception as ex:
                print("Error shortening URL, retrying...")

        stringResponse = stringResponse + '-----------<a href="' + url + '"> <b>Listing ' + str(
            i) + '</b></a>-----------' + "\n<i>Name</i>: " + listingDetails[
                'name'] + "\n<i>Rating</i>: " + listingDetails[
                    'rating'] + "\n<i>Price</i>: " + listingDetails[
                        'price'] + "\n<i>Apartment</i>: " + listingDetails[
                            'inventory'] + "\n"

        #Get venues based on coords
        print("Getting Venues...")
        coord = listingDetails['coordinates'].split(',')
        nearbyVenues = get_venues(coord[0], coord[1])
        venues = pd.DataFrame(nearbyVenues)

        stringResponse = stringResponse + '\n<u><i>Top Venues near this listing</i></u>\n'

        #Create a map with folium then convert html to png
        print("Creating Folium map...")
        create_folium_map(nearbyVenues, coord[0], coord[1], telegramChatID)
        convert_html_to_jpg()

        #Printing Venues
        for idx, venue in venues.iterrows():
            if (idx + 1) >= len(venues.index):
                stringResponse = stringResponse + str(
                    idx + 1) + ". " + venue[0].replace(
                        "&", "and") + " (" + venue[1] + ")\n\n"
            else:
                stringResponse = stringResponse + str(
                    idx + 1) + ". " + venue[0].replace(
                        "&", "and") + " (" + venue[1] + ")\n"

        #Send text info
        if telegramChannel:
            print("Sending telegram text...")
            telegram_bot_sendtext(stringResponse, telegramChatID)
        #Send images as an album
        print("Sending telegram group pics...")
        telegram_bot_sendGroupMedia(listingDetails['picurl'][0:7],
                                    telegramChatID, i)
        print("Done sending telegram group pics...")
        i += 1
        stringResponse = ""
    telegram_bot_sendtext(
        "\U0001F601 Search has been completed. Plese review our recommendations, thank you! \U0001F6C4\U00002708\U0001F3E1",
        telegramChatID)
Пример #27
0
def urlfunc():
    url = urltext.get()
    urllink = StringVar()
    link = pyshorteners.Shortener().tinyurl.short(url)
    entry2 = Entry(root, textvariable = urllink).grid(row=3,column=1,ipadx=10)
    urllink.set(link)
Пример #28
0
async def kısalt(ctx, a: str):
    link = a
    kısaltıcı = pyshorteners.Shortener()
    x = kısaltıcı.tinyurl.short(link)
    await ctx.send(x)
Пример #29
0
def shorten():

    short_url = srt.Shortener().tinyurl.short(link.get())
    link.set(short_url)
    pyperclip.copy(short_url)
    clip.set('Copied to Clipboard')
Пример #30
0
def osdb(url):
    return pyshorteners.Shortener().osdb.short(url)