Issue
from bs4 import BeautifulSoup
import requests
from datetime import datetime
from dateutil.relativedelta import relativedelta
evr_begin = datetime.now().strftime("%m/%d/%Y")
evr_end = (datetime.now() + relativedelta(months=1)).strftime("%m/%d/%Y")
url = "https://mms.kcbs.us/members/evr_search_ol_json.php?" \
f"otype=TEXT&evr_map_type=2&org_id=KCBA&evr_begin={evr_begin}&evr_end=.
{evr_end}&" \ "evr_radius=50&evr_type=269&evr_region_type=1"
response = requests.request("GET", url)
soup = BeautifulSoup(response.text, features='lxml')
for event in soup.find_all('div', class_='row'):
kcbs_competition = event.find('b').getText()
kcbs_comp_date = event.find('i').getText()
print(kcbs_competition, kcbs_comp_date)
for info in soup.find_all('div',class_='col-md-4'):
print(info.find('a').getText())
Here is the link to the website https://mms.kcbs.us/members/evr_search.php?org_id=KCBA I'm am trying to pull everything under the name and date.
Solution
You can get the desired data just using the API url. An example is given below:
from bs4 import BeautifulSoup
import requests
from datetime import datetime
url = 'https://mms.kcbs.us/members/evr_search_ol_json.php?otype=TEXT&evr_map_type=2&org_id=KCBA&evr_begin=6/15/2022&evr_end=7/15/2022&evr_address=&evr_radius=50&evr_type=269&evr_openings=0&evr_region=&evr_region_type=1&evr_judge=0&evr_keyword=&evr_rep_name='
response = requests.get(url)
soup = BeautifulSoup(response.text, features='lxml')
item=[x.get_text(strip=True) for x in soup.select('div.col-md-4:nth-child(1)')]
print(item)
item2=[x.get_text(strip=True) for x in soup.select('div.col-md-4:nth-child(2)')]
print(item2)
Output:
['Frisco BBQ Challenge6/16/2022 - 6/18/2022Frisco, CO 80443UNITED STATES', 'York County BBQ Festival6/17/2022 - 6/18/2022Delta, PA 17314UNITED STATES', 'Central Plains Ribfest6/17/2022 - 6/18/2022Holdrege, NE 68949UNITED STATES', 'Knights Of Columbus BBQ Smoke Off "4 Life"6/17/2022 - 6/18/2022Kansas City, KS 66106UNITED STATES', 'Rose Festival 21st Annual KCBS BBQ Contest6/17/2022 - 6/18/2022State Center, IA 50247UNITED STATES', 'Hoosier BBQ Classic Day 16/17/2022 - 6/18/2022Franklin, IN 46131UNITED STATES', 'Hoosier BBQ Classic (One Meat Ribs)6/17/2022 - 6/17/2022Franklin, IN 46131UNITED STATES', 'Almost Heaven BBQ Bash6/17/2022 - 6/18/2022Roanoke,
WV 26447UNITED STATES', 'Central Plains Ribfest (Steak)6/17/2022 - 6/17/2022Holdrege, NE 68949UNITED STATES', 'Clay County Juneteenth BBQ Contest (One Meat Ribs)6/17/2022 - 6/18/2022Liberty, MO 64068UNITED STATES', 'BBQ Battle Finland (POSTPONED)6/18/2022 - 6/19/2022Tampere, 33840FINLAND', 'The War of Barbeque6/18/2022 - 6/19/2022Isola della Scala (VR), 300257ITALY', 'Hoosier BBQ Classic Day 26/18/2022 - 6/19/2022Franklin, IN 46131UNITED STATES', 'The War of Barbeque (ONE MEAT RIBS)6/18/2022 - 6/18/2022Isola della Scala (VR), 300257ITALY', 'Columbia Valley Smokeshow6/24/2022 - 6/26/2022Invermere, V0A1K0CANADA', 'The Cache Smokeout at the American West Heritage Center (POSTPONED UNTIL 2023)6/24/2022 - 6/25/2022Logan, UT 84321UNITED STATES', 'Big BBQ Bash6/24/2022 - 6/25/2022Maryville, TN 37804UNITED STATES', 'Heritage Days BBQ Showdown (Day One)6/24/2022 - 6/25/2022Belvidere, IL 61008UNITED STATES', 'The Great Lenexa BBQ Battle - Kansas State Championship6/24/2022 - 6/25/2022Lenexa, KS 66227UNITED STATES', 'Miles City Cowtown Cookoff6/24/2022 - 6/25/2022Miles City, MT 59301UNITED STATES', 'Lake Murvaul BBQ Cook-Off6/24/2022 - 6/26/2022Carthage, TX 75633UNITED STATES', 'Smokin Deltana BBQ Challenge (POSTPONED)6/24/2022 - 6/25/2022Delta Junction, AK 99737UNITED STATES', 'Riverland Smokers BBQ Contest6/25/2022 - 6/26/20226669 MH Dodewaard,NETHERLANDS', 'Second Annual Central Maine BBQ Cookoff6/25/2022 - 6/26/2022Skowhegan, ME 04976UNITED STATES', 'Heritage Days BBQ Showdown (Day
Two)6/25/2022 - 6/26/2022Belvidere, IL 61008UNITED STATES', 'Giant National Capital Barbecue Battle6/25/2022 - 6/26/2022Washington , DC 20006UNITED STATES', 'Central Maine BBQ Cook Off (ONE MEAT RIBS)6/25/2022 - 6/25/2022Skowhegan, ME 04976UNITED STATES', "Lowell's Smokin' In the Ozarks-Arkansas State Challenge7/1/2022 - 7/2/2022Lowell, AR 72745UNITED STATES", 'Happy Basset 2nd Annual BBQ Competition7/1/2022 - 7/2/2022Topeka, KS 66609UNITED STATES', '2nd Annual VFW
Post 3396 Armed Forces BBQ Challenge (MASTERS)7/1/2022 - 7/2/2022Sparks, NV 89431UNITED STATES', 'The Art of BBQ7/1/2022 - 7/2/2022Sterling, CO 80751UNITED STATES', 'Twin Smoke7/2/2022 - 7/3/2022Vilnius, LT 14200LITHUANIA', 'Sweet Home Icebox Cookoff 20227/2/2022 - 7/3/2022Sweet Home, OR 97386UNITED STATES', '2nd Annual VFW Post 3396 Armed Forces BBQ Challenge (ONE MEAT RIBS)7/2/2022 - 7/2/2022Sparks, NV 89431UNITED STATES', 'Smokin with Weemala (One Meat Chicken)7/2/2022 - 7/2/2022Carmel , 6076AUSTRALIA', 'Smokin with Weemala (One Meat Ribs)7/2/2022 - 7/2/2022Carmel, 6076AUSTRALIA', 'South Carolina Festival of Discovery7/7/2022 - 7/9/2022Greenwood, SC 29648UNITED STATES', 'Ohio Veterans BBQ Cook-Off (CANCELLED)7/8/2022 - 7/9/2022Kettering, OH 45440UNITED STATES', 'Clayton BBQ Cook-off7/8/2022 - 7/9/2022Clayton, CA 94517UNITED STATES', 'Sand Creek Summer Daze Saucy & Glazed BBQ Competition7/8/2022 - 7/9/2022Newton, KS 67114UNITED STATES', 'Harvest on Fire at the Winery7/8/2022 - 7/9/2022Marshall, IL 62441UNITED STATES', '2022 Black Silos Swine in the Vine BBQ Contest (Day 1)7/8/2022 - 7/9/2022Trenton, MO 64683UNITED STATES', '2022 Black Silos Swine in the Vine BBQ Contest (Day 2)7/9/2022 - 7/10/2022Trenton, MO 64683UNITED STATES', 'New Jersey State Barbecue Championship7/9/2022 - 7/10/2022North Wildwood, NJ 08260UNITED STATES', 'Chillin & Grillin in the Glades7/15/2022 - 7/16/2022Wise, VA 24293UNITED STATES', 'KTD Smokin Gobbler Cook-off7/15/2022 - 7/16/2022Worthington, MN 56187UNITED STATES', 'KTD Smokin Gobbler Cook-off (One Meat Ribs)7/15/2022 - 7/16/2022Worthington, MN 56187UNITED STATES', 'Bordertown BBQ Brawl7/15/2022 - 7/16/2022Sault Ste Marie, MI 49774UNITED STATES', 'Bordertown BBQ Brawl (One Meat Ribs)7/15/2022 - 7/15/2022Sault Ste Marie, MI 49774UNITED STATES', 'Central Illinois BBQ Throwdown7/15/2022 - 7/16/2022Eureka, IL 61530UNITED STATES', 'Central Illinois BBQ Throwdown (One Meat Ribs)7/15/2022 - 7/15/2022Eureka, IL 61530UNITED STATES', '2022 Cameron Elks BBQ Cook Off (Day 1)7/15/2022 - 7/16/2022Cameron, MO 64429UNITED STATES']
['STATE CHAMPIONSHIPReps: BUNNY TUTTLE, RICH TUTTLE, MICHAEL WINTERPrize Money: $13,050.00', 'STATE CHAMPIONSHIPReps: ANGELA MCKEE, ROBERT MCKEE, LOUISE WEIDNERPrize Money: $5,500.00', 'STATE CHAMPIONSHIPReps: LARRY VOTH, LYNDA VOTHPrize Money: $10,000.00', 'STATE CHAMPIONSHIPReps: FORREST BRUCE, LARRY HADLEYPrize Money: $5,000.00', 'STATE CHAMPIONSHIPReps: CLARA WILLIAMS,
JONATHAN B WILLIAMSPrize Money: $7,000.00', 'STATE CHAMPIONSHIPReps: BECKY DRUETZLER, DAVE DRUETZLERPrize Money: $7,500.00', 'Reps: BECKY DRUETZLER, DAVE DRUETZLER', 'STATE CHAMPIONSHIPReps: JULIE COOK, RUSTY COOKPrize Money: $13,000.00', 'Reps: LARRY VOTH, LYNDA VOTHPrize Money: $1,500.00', 'Reps: ROSEMARY MORROWPrize Money: $1,350.00', 'Reps: ANGELA FISHLOCK, MARK FISHLOCK', 'Reps: HAYMO GUTWENIGER, LUCA FAMIGLI', 'STATE CHAMPIONSHIPReps: BECKY DRUETZLER, DAVE DRUETZLERPrize Money: $7,500.00', 'Reps: HAYMO GUTWENIGER, LUCA FAMIGLI', 'Reps: BRENDA BLACK, KEN BLACKPrize Money: $4,750.00', 'STATE CHAMPIONSHIPReps: STEVEN FLEWALLEN, BRIAN MOORE', 'STATE CHAMPIONSHIPReps: CONNIE AMIDEI, JONATHAN AMIDEIPrize Money: $10,000.00', 'STATE CHAMPIONSHIPReps: CHARLIE BRINZA, JEANNE TITUSPrize Money: $11,100.00', 'STATE CHAMPIONSHIPReps: FORREST
BRUCE, LARRY HADLEY, DAVE ROGERS, PEG ROGERSPrize Money: $13,300.00', 'STATE CHAMPIONSHIPReps: MICHAEL SANTIAGO, RHONDA SANTIAGOPrize Money: $9,450.00', 'STATE CHAMPIONSHIPReps: BOB MCKINNON, TERRI MCKINNON', 'Reps: BUNNY TUTTLE, RICH TUTTLE', 'Reps: MARIANNE VAN GALEN, MAYCO VAN GALENPrize Money: $1,800.00', 'STATE CHAMPIONSHIPReps: DOUG REID, ALAN ROTHROCKPrize Money: $10,000.00', 'STATE CHAMPIONSHIPReps: CHARLIE BRINZA, JEANNE TITUSPrize Money: $11,100.00', 'STATE CHAMPIONSHIPReps: ALEX JR BROWN, BILL JONESPrize Money: $14,400.00', 'Reps: DOUG REID, ALAN
ROTHROCK', 'STATE CHAMPIONSHIPReps: KAREN JANE WILLIAMS, RALPH WILLIAMSPrize Money: $15,000.00', 'STATE CHAMPIONSHIPReps: CLARA WILLIAMS, JONATHAN B WILLIAMSPrize Money: $3,800.00', 'Reps: MICHAEL SANTIAGO, RHONDA SANTIAGOPrize Money: $6,000.00', 'STATE CHAMPIONSHIPReps: MICHAEL WINTER, BRIAN MOOREPrize Money: $8,000.00', 'Reps: ANGELA FISHLOCK, MARK FISHLOCK', 'STATE CHAMPIONSHIPReps: JULIE POE, IAN SCHMIDTPrize Money: $25,000.00', 'Reps: MICHAEL SANTIAGO, RHONDA SANTIAGOPrize Money: $500.00', 'Reps: KARINA RUMENS, ROB STEVENS', 'Reps: KARINA RUMENS, ROB STEVENS', 'STATE CHAMPIONSHIPReps: JULIE COOK, RUSTY COOK, CAROLYN WELLS, DOUG REID, MIKE GARRETSONPrize Money: $19,850.00', 'STATE CHAMPIONSHIPReps: SCOTT GRINSTEAD, STEVE GRINSTEAD', 'STATE CHAMPIONSHIPReps: JULIE POE, IAN SCHMIDTPrize Money: $8,975.00', 'STATE CHAMPIONSHIPReps: LARRY VOTH, LYNDA VOTH', 'STATE CHAMPIONSHIPReps: BECKY DRUETZLER, DAVE DRUETZLERPrize Money: $3,070.00', 'STATE CHAMPIONSHIPReps: ROSEMARY MORROW, FORREST BRUCE', 'STATE CHAMPIONSHIPReps: FORREST BRUCE, ROSEMARY MORROW', 'STATE CHAMPIONSHIPReps: JEFF CHAMBERS, REGINA BODNAR, LOUISE
WEIDNERPrize Money: $8,800.00', 'STATE CHAMPIONSHIPReps: ALEX JR BROWN, BILL JONES', 'STATE CHAMPIONSHIPReps: JOHN SCHARFFBILLIG, JEANNE TITUS', 'Reps: JOHN SCHARFFBILLIG, JEANNE TITUS', 'STATE CHAMPIONSHIPReps: BECKY DRUETZLER, DAVE DRUETZLERPrize Money: $6,500.00', 'Reps: BECKY DRUETZLER, DAVE DRUETZLERPrize Money: $600.00', 'STATE CHAMPIONSHIPReps: DAVE ROGERS, PEG ROGERS', 'Reps: DAVE ROGERS, PEG ROGERS', 'STATE CHAMPIONSHIPReps: DONNA YOUNG, ED YOUNG']
Answered By - F.Hoque
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.