mirror of https://github.com/Bunsly/JobSpy
filter by choice and hours works
parent
0565c0ed16
commit
c47c1a7e77
|
@ -16,6 +16,12 @@ class GoozaliScrapperComponent:
|
|||
pass
|
||||
|
||||
# Function to filter GoozaliRows based on hours old
|
||||
def filter_rows_by_column_choice(self, rows: list[GoozaliRow], column: GoozaliColumn, column_choice: GoozaliColumnChoice) -> list[GoozaliRow]:
|
||||
return [
|
||||
row for row in rows
|
||||
if row.cellValuesByColumnId[column.id] == column_choice.id
|
||||
]
|
||||
|
||||
def filter_rows_by_hours(self, rows: list[GoozaliRow], hours: int) -> list[GoozaliRow]:
|
||||
# Current time
|
||||
now = datetime.now()
|
||||
|
|
|
@ -24,11 +24,16 @@ try:
|
|||
|
||||
component = GoozaliScrapperComponent()
|
||||
hours_old = 200
|
||||
field_cloumn = component.find_column(response_data.columns, "Field")
|
||||
software_engineering_choice = component.find_choice_from_column(
|
||||
field_cloumn, "Software Engineering")
|
||||
filtered_rows_by_age = component.filter_rows_by_hours(
|
||||
response_data.rows, hours_old)
|
||||
column = component.find_column(response_data.columns, "Field")
|
||||
column_choice = component.find_choice_from_column(
|
||||
column, "Software Engineering")
|
||||
|
||||
filtered_rows_by_column_choice = component.filter_rows_by_column_choice(
|
||||
response_data.rows, column, column_choice)
|
||||
filtered_rows_by_age_and_column_choice = component.filter_rows_by_hours(
|
||||
filtered_rows_by_column_choice, hours_old)
|
||||
|
||||
filtered_rows_by_age_and_column_choice
|
||||
except FileNotFoundError:
|
||||
print("The file was not found.")
|
||||
except json.JSONDecodeError:
|
||||
|
|
Loading…
Reference in New Issue