How shit is my python?

import poplib
import email
import re
import os
from subprocess import call

DOWNLOAD_FORMAT = os.path.join(
os.path.expanduser('~'),
"Videos/YouTubeInbox/%(title)s.%(ext)s"
)

EMAIL_HOST = 'mail.cock.li'
EMAIL_USER_NAME = '[email protected]'
EMAIL_PASSWORD = 'ultrafuckingsecure'

mail = poplib.POP3_SSL(EMAIL_HOST)
print(mail.getwelcome())
print(mail.user(EMAIL_USER_NAME))
print(mail.pass_(EMAIL_PASSWORD))
print(mail.stat())
print(mail.list())

if mail.stat()[1] > 0:
print("You have new mail.")
else:
print("No new mail.")


numMessages = len(mail.list()[1])
for i in range(numMessages):
for j in mail.retr(i+1)[1]:
msg = email.message_from_string(str(j, 'utf-8'))
payload = msg.get_payload()
url = re.search("(?Phttps?://[^\s'\"]+)", payload)
if url is not None:
vurl = url.group("url")
print(vurl)
print("Downloading to: ", DOWNLOAD_FORMAT)
call(["youtube-dl", "--max-downloads","1", "-o", DOWNLOAD_FORMAT, vurl])
mail.dele(i+1)[1]

mail.quit()

Attached: iMacBag.jpg (750x946, 103K)

Not bad except youtubedl is itself a python library you can just import it instead of using call

I always laugh when I see python code because of the design of range.
The script is too trivial, there's nothing to say about it.

actually good python. noyce.

> using import

remove spacing, and put it all on 1 line so it executes fazter

alternative?

apt-get
dpkg
brew

print("You have new mail." if mail.stat()[1] > 0 else "No new mail.")

for x, i in enumerate(mail.list()[1])):

import poplib,email,re,os

word!

why is it trivial?

Make your code more readable:

replace any larger than one/two word with a variable (used like a constant) which describes what it's doing or needed for

If referring to a "magic" index, replace it with a constant named something like new_mail_index

make all of your regex patterns referenced by a variable which describes what they do

Though i and j are suitable for loops, you should consider naming what they are iterating over rather than just giving them a random undescriptive single letter

Essentially, that main problem with your code is readability. You should refrain from having "magic" inline values, and instead refer to them by descriptive variables/constants. Additionally make sure all variables are descriptive to what they are used for, even if only used for a loop

w a t

so user should pretend he's making youtube-poop downloaders for a big company that has 'koding style standards'?

Attached: bl.png (645x729, 77K)

This

>A. first and foremost, you must kode with klossy.

t. middle management shitter

Sure, if this is a one off "I just need this thing for a one time use" it's fine as is. But, having readable code (using whatever standards you fucking want) is great because if you ever need to revisit your code for some reason, or need something random to show a potential employer, you don't need to dig through documentation or reverse engineer it to understand it

import just goes to the first result it can find. You never know what package you're getting. apt-get and others have verified sources.

Perhaps you should take a look at CNN's or RNN'

You should neck yourself