Tumgik
#once all of these r done I’ll probably throw them in his info tag
kyngsnake · 2 years
Text
Tumblr media
making his tiddy piece look ✨clean✨
18 notes · View notes
laketaj24 · 6 years
Text
Love and Hip-Hop: Wakanda, (Black Panther Headcannons)
A/N: I’m totally random and if you follow my Vikings posts you will figure out I’m obsessed with placing a fandom in the reality world 😂 I was bored on lunch and thought this up! Might add more, but this is just for fun! I hope you enjoy!
No Warnings lol
Tumblr media Tumblr media
T’Challa “King” Udaku, Record Label CEO BP Music Group
T’Challa Confessional: What’s up! I’m T’Challa, an executive producer and the owner of BP Music Group. You probably know me by my stage name King. I still sing, but I would rather produce now. So, I started BP Music Group a year after my pops died, a tribute to him. We’ve been the hottest record label in all Wakanda for five years, no matter what you done heard. Our artists are untouchable.  You probably done heard my music before producing artists like Daniel Cesar and SZA. The rock in my life is Nakia. She’s a special girl, she’s always there for me.
Nakia enters the studio while T’Challa is working with SZA. Sits in between them.
T’Challa: can we help you?
Nakia: Nah, continue.
T’Challa: O-Kay. (rolls his eyes starting the song back over, leans awkwardly to see SZA.) This song would be great for you.
T’Challa Confessional: She a little protective. But I wouldn’t trade her for anything. She been down for me since we were kids. Haven’t got married yet because it’s just not the time.
-          Never cheats on his girl, but when they’re on a break he wilds out
-          Dropped Erik from the label for personal differences
-          Hasn’t had a hit in three years, blames it on the music industry
-          Asks his mom about every business decision
-          Best friends with W’Kabi and M’Baku
-          Only hangs around Erik when he needs something
-          Thinks his label is bigger than it truly is, (DJ SELF low key)
Tumblr media
Nakia, Fashion Desinger, Former Milaje Trois Member
Nakia confessional: I’m Nakia. I used to sing and all that but I wanted to get away from all of that.  I currently run a clothing line called Wakandan Glam, it’s nothing major. Just a million-dollar company. We make shoes, clothes and I’m starting to dabble in cosmetics. I’ve been with King for over ten years and he still hasn’t proposed. I keep talking to his mom and she ain’t got the answer either. So, I set up a deadline for myself, one more year and I’m moving on. There are several other men that want this successful, educated black woman. You feel me? Okay. Good.
Hands T’Challa a magazine with rings and points one.
Nakia: Just in case you wondering.
T’Challa: Aight. But I wasn’t.  (hands her the magazine back, the continues to watch the game on TV)
Nakia Confessional: One more Year.
-          Used to sing in a girl group called The Milaje Trois with Ayo and Okoye.
-          Thought she was the lead singer, still gets a rush when people ask for her autograph.
-          Claims she started the company from scratch but T’Challa is the money
-          Talks to Ramonda about her son and tries to convince him she’s the wife
-          Lives with T’Challa but always suspects he’s cheating, follows him and goes through his phone from time to time.
-          Still close friends with O’Koye but doesn’t trust her around T’Challa.
-          Slept with Erik once when she was drunk, refuses to admit it. (Granted he got a video)
Tumblr media
Okoye, “Koko”, former member of Milaje Trois, A&R Rep for BP Music Group
Okoye confessional: Hi, I’m O’koye, Head of A&R for BP Music Group. I’ve represented T’Challa for over five years and I represent other artists such as Shuri and Bucky. I try to keep everything professional and I put up with nonsense, which can be hard as hell working with Shuri because she always has something up her sleeve. I’m married to W’Kabi, he just got out of prison for embezzlement. I don’t want to talk about, just know this dude is thin ice with me. I mean thin.
W’Kabi: Babe, you hungry?
O’Koye: Yeah we can eat after I finish this session. (Points to Shuri whose showing her the new lyrics to her song)
W’Kabi: I’m hungry now. (He shrugs) she can wait. Can’t you wait?
O’Koye: (eyes widen and slams down her phone) Hey, what did I say
O’Koye confessional: I mean he doesn’t understand I’m the bread in this relationship which means I steer the boat. He’s. (Pinches the bridge of her nose) Whatever, like I said… this damn ice.
-          Plans on leaving BP Music Group one day and opening a management firm
-          Best friends with T’Challa makes him weary of making life decisions he hasn’t thought out yet, like marrying Nakia.
-          Saves her money,
-          Does not fraternize at work
-          Would rather be single sometimes when she thinks about the bad image W’Kabi brings
-          Does not like Erik, but is proud of him for forming his own record label.
-          Best friends with Ayo, does not support her relationship with Erik
Tumblr media
Erik, Golden Jag Music CEO, Producer
Erik Confessional: Yo, what’s going on people. I’m Erik, the sole owner of Golden Jag Muzik. I’ve had several hits including: Arch that Shit, Bottom Out and Throw it Back. I left BP Music Group about five years ago, because his shit got wack, and now I manage artists and get sold out shows and shit. Right now, I got this new artists named Chiron, he young I’m teaching him the ropes and shit. I have no woman, and no kids, that I know of. (Pauses) Call me the pullout champ. (winks at camera) I fuck with this one chick heavy but she just cool. Tryna get her rap game off the ground. Following my golden Rule: Secure the Bag then Secure the Ass. It’s all about the dollar.
Ayo: Did you book me for the Women Festival? Ayo sits in Erik’s lap planting kisses down his neck.
Erik: I mean what you gone give me in return, you know the strings I’m gonna have to pull to get you there? (touches her face)
Ayo: Just do it, E.
Erik: I’ll see what I can do after I see what you can do
Ayo: You fuck Chiron before you book his tours
Erik: Hell nah.
Erik Confessional: I really like her, though. I think that she can go far in the game and I plan on taking her there. And Chiron too.
-          Claims to be single but gets mad if Ayo talks to anyone else
-          Fucks with other girls won’t let Ayo know though
-          Doesn’t like T’Challa and usually ignores his calls
-          All his classic hits are still big in the club scene but he can’t sell a new record for nothing
-          Mentors Chiron,
-          Gets all his info from Media Takeout and TMZ and gossip bloggers
-          Best Friends with W’Kabi but constantly calls him a bitch
Tumblr media
M’Baku, CEO of Jabari Markets
M’Baku: I’m M’Baku. I don’t sing. I don’t dance. I run a marketing company that advertises the hottest artist in Wakanda. I pair with both BP Music and Golden Jag. Their artists use me for promotions and booking. I just like to make money. Jabari Markets is something that took time and we don’t allow people to bullshit us, catch these hands if that’s the case. There is no lucky lady currently. I just like to work, get this money and travel. Nothing better than not having the strings these other two got.
T’Challa flips his phone over.
M’Baku: Man will you just answer the damn phone? (sips his Hennessey.)
T’Challa: It’s Nakia.
Erik: (phone vibrates) Now she calling me. Why she won’t call you?
M’Baku: I blocked her number. I ain’t got time for that shit.
M’Baku Confessional: Like I said, I keep to myself and I handle This business. I’m not like the rest. My business is first.
- born and raised in Wakanda, lives on estate in the mountains to stay away from drama
- thinking about recruiting small femal staff
- likes Erik okay, doesn’t trust w’Kabi
-friends with T’Challa for over fifteen years, marketed his tours free of charge
- does not take kindly to threats, will beat ass if disrespected
Tagging:   @wakanda-inspired @misspooh @valynsia  @vanitykocaine @harleycativy @jecourt @virgosapphire79 @eriknutinthispoosy @sparklemichele @theunsweetenedtruth @ahhhhkeya  @iamrheaspeaks @thiccdaddy-mbaku @muse-of-mbaku @myboyfriendgiriboy @someareblindtoitsbeauty @brittyevans @almostpurelysmut @yaachtynoboat711 @readsalot73 @ivarsshieldmadien @slimmiyagi @cinnabearice @bidibidibombaclaat @royallyprincesslilly @hutchj @igetcarriedawaywithyou @madamslayyy @bartierbakarimobisson @killmongersaidheyauntie @hdkween
435 notes · View notes
python-planet-blog · 7 years
Text
Rundown of Selenium and BeautifulSoup (BS4)
Hi everyone. For the first post here I am going to cover a topic that I've seen people ask about in online Python communities such as r/learnpython. This is a quick rundown of how to use Selenium and BeautifulSoup to interact with websites and parse html. Now, these concepts can be applied to do anything from scrape the web to automate processes and make bots.
Honestly, this first post is all the info you need to begin effectively working with these modules.
Let's start with
SELENIUM
Selenium is a web testing module that can be used to interact with web elements, which has applications such as the ones mentioned above.
To import selenium, I like to do the following:
   from selenium import webdriver    from selenium.webdriver.common.by import By    from selenium.webdriver.support.ui import WebDriverWait    from selenium.webdriver.common.keys import Keys    from selenium.webdriver.support import expected_conditions as EC    from selenium.common.exceptions import TimeoutException, NoSuchElementException, UnexpectedAlertPresentException, WebDriverException    from selenium.webdriver.chrome.options import Options
It doesn't add much load to import all of these, and you'll end up using most (probably all) if you are working with Selenium in any substantial way.
The last one is only necessary if you're using Chromedriver, not Firefox. I would reccomend chromedriver as it seems a bit faster and cleaner to me.
Next, we need to initailize our WebDriver object:
   opts = Options()    opts.add_argument("user-agent='your-user-agent")    driver = webdriver.Chrome('/path/to/chromedriver', chrome_options = opts)    driver.wait = WebDriverWait(driver, 15)
A few things here. One, where it says 'your-user-agent,' you should put your user agent (shocker). This isn't strictly necessary, but often the default python requests user agent will get blocked/rate limited by sites as everyone using python at a given moment without specifying their user agent is telegraphing that user agent.
To get your user agent, google 'what is my user agent.'
If you're using chromedriver, you need to put the path to where chromedriver executable is on your machine.
Otherwise, for Firefox:
   profile = webdriver.FirefoxProfile()    profile.set_preference('general.useragent.override','your-user-agent')    driver = webdriver.Firefox(profile)    driver.wait = WebDriverWait(driver, 15)
The driver.wait line sets the implicit wait for the WebDriver object. I'll get to that in a second.
So, now we've got the driver initialized, so let's interact with some web elements.
   driver.get(url)
This opens url in our webdriver.
Interacting with web sites via Selenium/bs4 is, like much of programming, consists largely of telling python what things are and then what to do to them.
To use Selenium (and bs4) you must use the Web Inspector to analyze your webpage and find out how to identify web elements. I reccomend using the web inspector in either Safari or Chrome, as these browsers offer the handy 'copy xpath' functionality.
We can identify web elements in a number of ways. We can use HTML tag attributes such as name, id, class name, tag name. We can use XPATH or CSS Selector. There are other options too, all listed here.
Tag names look like this:
<a href='https://www.reddit.com' class= 'title may-blank outbound' title= efwefwerfwf>... </a>
The 'a' is the tag name. The thing after class is the class. All other tag attrs (name, id etc) work like that. They're in orange/yellow in the safari web inspector.
CSS Selectors look like this:
   a.title.may-blank.outbound
XPATHs look like this:
   //*[@id="new_post_buttons"]/div[4]/div[2]/div/div[5]/div[1]/div/div[3]/div/div/button
You can get CSS selectors by mousing over elements in the Web Inspector. You can get xpath by selecting an element (click the target thing in Safari or the arrow thing in Chrome, and then click the desired element) and then right clicking the corresponding html (it will become highlighted) and clicking 'copy xpath.'
The syntax to find elements is as follows:
This returns the first matched web element (going down the source HTML):
link = driver.find_elements_by_xpath(’this-xpath’)
 And this returns a list of all matched elements:
  links = driver.find_elements_by_tag_name('a')
Detailed syntax, showing similar underscore syntax ways to find by the aforementioned parameters, can be found at the docs link from earlier.
This approach, using find_elements_by_xyz, uses an implicit wait (remember that from before?)
When the driver is told to find an element, it must first wait for the element to be loaded. Using an implicit wait means it will wait up to n seconds specified in
   driver.wait=WebDriverWait(driver, n)
before throwing a TimeoutException.
This is NOT THE BEST PRACTICE. I really only use implicit waits when I need a list of all the matched elements:
time.sleep(5)
my_xyzs = driver.find_elements_by_xyz(’my-xyz’)
my_fav_xyz = my_xyzs[9]
Technically, you shouldn't need the time.sleep(5)... but implicit waits can be inconsistent, so I throw it in there to make sure the page has loaded by the time Selenium looks to construct the list of matching elements.
So, most of the time, you should use explicit waits. Instead of finding elements via the find_element(s) commands, use:
   elem = driver.wait.until(EC.element_to_be_clickable(        (By.XPATH, 'my-xpath')))
Again, full syntax available which details all possible excepted conditions (the EC). This means that you can wait for the element in question to be clickable, visible, present, stale..you have a lot of options. Similarly, elements can be designated for waits By.XPATH, tag name, class name, css selector, and more.
But what if the element we need is only differentiated by an esoteric html tag attribute, I hear you lament.
Not to worry. We can use XPATH to designate a web element by ANY tag attribute.
   elem = driver.wait.until(EC.visibility_of_element_located(        (By.XPATH, '//[@attr="value"]')))
The above code designates elem as the web element on that page with tag attribute attr equal to 'value'. You can put a tag name in between the // and [ to specify further:
       '//div[@attr='value']'
This finds only div tags with attr='value'.
Once we have identified our web element by an HTML attribute, xpath, or css selector, and defined it in Python using selenium syntax, we can do many things to it:
   elem.click() #clicks elem    elem.send_keys('abc') #types 'abc' into elem    elem.get_attribute('href') # gets the 'href' attr of elem    elem.send_keys(Keys.COMMAND, 'v') #pastes -- all keyboard shortcuts are similarly available
One caveat on shortcuts: ChromeDriver on OS X does not support most keyboard shortcuts. If you have to paste on os x with chromedriver, the following will get the job done:
   elem.send_keys(Keys.SHIFT, Keys. INSERT)
It doesn't matter if your Mac doesn't have an insert key-- windows shortcuts seem to work on mac selenium. I imagine other shortcuts can be used on chromedriver using this workaround.
To get the html of a page loaded in the driver:
   driver.page_source
Other commands I use relatively often:
   driver.back() #goes back    driver.quit() #quits
----THAT'S IT!
I mean, there's more to Selenium, but that's more than enough info for you to discover the rest on your own.
BeautifulSoup
A lot of the HTML stuff from up there will translate well to bs4 as well. bs4 is used to parse HTML. If you want to scrape info from a website, or whatever, bs4 is going to help you do it. The syntax is VERY straightforward-- gotta love Python.
Like any great chef (and the bs4 docs) will tell you, first we need to make the soup.
   from bs4 import BeautifulSoup as bs4    driver.get('https://www.reddit.com')    soup = bs4(driver.page_source, 'html.parser')
So what's going on here? First, we import bs4. Then we use Selenium to open a URL. We then create our soup object. First argument is driver.page_source, meaning we want to parse the source html of the current driver page. Then, 'html.parser' specifies which parser we want to use. You can use lxml if you want. I have no idea what the difference is. If one isn't working, try switching-- this has never been a problem for me.
Go ahead and print
   (soup.prettify())
to see what's what here-- it'll be a bunch of HTML. You can print (soup.text()) to get just the text.
Ok, so how do we actually parse the HTML? We use the find() and find_all() methods.
   links = soup.find_all('a')
Both find and find_all accept a tag name as the first argument. The second argument is class_ (underscore to differentiate from Python classes).
   account_links = soup.find_all('a', class_='account')
The difference between find() and find_all() is that find() returns the first match and find_all() returns a list of matches.
As before, we can find()/find_all() by ANY tag attr, this time by passing a dict:
   names = soup.find_all('a', attrs={'id':'name'})
I find that SO nice. Hope you do too.
Now, these methods return tag(s). Meaning
   soup.find('div')
will find the first 'div' tag in the HTML, and return everything between its beginnning <div> and its end </div> 
I find that we rarely want the whole content of the tag haha. So, to grab just the TEXT in this tag, we can do:
   soup.find('div').text
Or, to get the value of any tag attribute:
   soup.find('a')['href'] #replace 'href' with whatver tag 'attr' you want to get the value of
FINALLY, a helpful tactic in web scraping: narrow your search!
If you want to go down LinkedIn Recruiter search results and grab everyone's name, first make a list of all the profile cards, and then look in each one for the name. That way you decrease the amount of 'p' tags (or whatever) in your search area and make it easier to grab the right ones.
e.g.:
   cards = soup.find_all('div',class_='profile_card')    for card in cards:        name = card.find('p')
And, actually, a helpful tactic in building bots/automating processes: you can use bs4 to scrape a website and make the bots job easier. If how to interact with the web elements to get your desired outcome is not immediately clear, pull up the web inspector and see if the link (or whatever, ember perhaps) you need is stored in the HTML somewhere! Then you can just pull
   driver.page_source
with bs4 and parse out what you need. Often, link 'suffixes' such as '/post/comments/12314141/this-is-a-great-post-man' will be stored in the 'href' attrs of HTML tags. You can parse that out and store it in link, and then do
   driver.get(url+link)
to save you some hassle. Just a thought.
Anyway, I hope you got some value from this. If so, LMK! I might make videos doing some examples or respond to specific questions or just otherwise maintain some sort of presence in this line of content.
1 note · View note